• 大小: 8.29MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-11-18
  • 语言: 其他
  • 标签: QT  

资源简介

自定义的QFileDialog,

资源截图

代码片段和文件信息

#include “customfiledialog.h“

#include 
#include 
#include 
#include 
#include 
#include 
#include yledItemDelegate>
#include 
#include 

class NoFocusDelegate : public QstyledItemDelegate
{
public:
NoFocusDelegate(Qobject *parent) :QstyledItemDelegate(parent)
{

};

public:
void paint(QPainter* painter const QstyleOptionViewItem &option const QModelIndex &index) const
{
QstyleOptionViewItem itemOptin(option);
if (itemOptin.state & Qstyle::State_HasFocus)
itemOptin.state = itemOptin.state ^ Qstyle::State_HasFocus;
return QstyledItemDelegate::paint(painter itemOptin index);
};
};

CustomFileDialog::CustomFileDialog(QWidget *parent)
: QDialog(parent)
{
ui.setupUi(this);
m_fileDialog = new QFileDialog(this Qt::SubWindow | Qt::framelessWindowHint);
m_fileDialog->setAttribute(Qt::WA_TranslucentBackground);
m_fileDialog->setOption(QFileDialog::DontUseNativeDialog true);
ui.bodylayout->addWidget(m_fileDialog);

this->setAttribute(Qt::WA_TranslucentBackground);
this->setWindowFlags(Qt::framelessWindowHint);
    settitleName(“文件选择框“);

QLabel* lookinLabel = m_fileDialog->findChild(“lookInLabel“);
if (lookinLabel)
        lookinLabel->setText(“文件目录:“);

QComboBox* fileTypeCombo = m_fileDialog->findChild(“fileTypeCombo“);
if (fileTypeCombo)
fileTypeCombo->setMinimumHeight(24);
QComboBox* lookInCombo = m_fileDialog->findChild(“lookInCombo“);
if (lookInCombo)
lookInCombo->setMinimumHeight(24); 
QLineEdit* fileNameEdit = m_fileDialog->findChild(“fileNameEdit“);
if (fileNameEdit)
fileNameEdit->setMinimumHeight(24);

QDialogButtonBox *buttonBox = m_fileDialog->findChild(“buttonBox“);
if (QPushButton *button = buttonBox->button(QDialogButtonBox::Open)){
button->setstyleSheet(“QPushButton{background-color: qlineargradient(x1: 0 y1: 0 x2: 1 y2: 0stop: 0 #00BAFF stop: 1 #00A1FF);font-size: 12px;color: #FFFFFF;border-radius:2px;}“
  “QPushButton:hover{background: #00C1FF;font-size: 12px;color: #FFFFFF;border-radius:2px;}“
  “QPushButton:disabled{background: #F0F0F0;border: 1px solid #DDDDDD;font-size: 12px;color: #BBBBBB;border-radius:2px;}“);
button->setFixedSize(68 24);
}
if (QPushButton *button = buttonBox->button(QDialogButtonBox::Save)){
button->setstyleSheet(“QPushButton{background-color: qlineargradient(x1: 0 y1: 0 x2: 1 y2: 0stop: 0 #00BAFF stop: 1 #00A1FF);font-size: 12px;color: #FFFFFF;border-radius:2px;}“
  “QPushButton:hover{background: #00C1FF;font-size: 12px;color: #FFFFFF;border-radius:2px;}“
  “QPushButton:disabled{background: #F0F0F0;border: 1px solid #DDDDDD;font-size: 12px;color: #BBBBBB;border-radius:2px;}“);
button->setFixedSize(68 24);
}
if (QPushButton *button = buttonBox->button(QDialogButtonBox::Cancel)){
button->se

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       5841  2019-01-09 15:19  QFileDialog\CustomFileDialog\CustomFileDialog\customfiledialog.cpp

     文件        752  2018-09-18 19:54  QFileDialog\CustomFileDialog\CustomFileDialog\customfiledialog.h

     文件        740  2018-09-18 19:20  QFileDialog\CustomFileDialog\CustomFileDialog\CustomFileDialog.pro

     文件      45834  2019-01-09 16:44  QFileDialog\CustomFileDialog\CustomFileDialog\CustomFileDialog.pro.user

     文件      23998  2018-09-18 19:20  QFileDialog\CustomFileDialog\CustomFileDialog\CustomFileDialog.pro.user.fadbeb7

     文件        418  2018-09-18 09:59  QFileDialog\CustomFileDialog\CustomFileDialog\customfiledialog.qrc

     文件       9347  2019-01-09 15:34  QFileDialog\CustomFileDialog\CustomFileDialog\customfiledialog.ui

     文件      17900  2018-09-18 19:23  QFileDialog\CustomFileDialog\CustomFileDialog\CustomFileDialog.vcxproj

     文件       5207  2018-09-18 19:23  QFileDialog\CustomFileDialog\CustomFileDialog\CustomFileDialog.vcxproj.filters

     文件        633  2018-09-18 19:23  QFileDialog\CustomFileDialog\CustomFileDialog\CustomFileDialog.vcxproj.user

     文件        466  2018-09-18 19:57  QFileDialog\CustomFileDialog\CustomFileDialog\main.cpp

     文件     117344  2018-09-18 10:47  QFileDialog\CustomFileDialog\CustomFileDialog\qt_zh_CN.qm

     文件     293122  2018-09-18 10:49  QFileDialog\CustomFileDialog\CustomFileDialog\qt_zh_CN.ts

     文件       2275  2018-09-13 09:27  QFileDialog\CustomFileDialog\CustomFileDialog\Resources\back.png

     文件        242  2018-09-13 09:27  QFileDialog\CustomFileDialog\CustomFileDialog\Resources\drop-down.png

     文件        234  2018-09-13 09:27  QFileDialog\CustomFileDialog\CustomFileDialog\Resources\drop-up.png

     文件       1000  2018-09-13 09:27  QFileDialog\CustomFileDialog\CustomFileDialog\Resources\sysclose.png

     文件       1003  2018-09-13 09:27  QFileDialog\CustomFileDialog\CustomFileDialog\Resources\sysclose_hover.png

     文件        958  2018-09-13 09:27  QFileDialog\CustomFileDialog\CustomFileDialog\Resources\sysmin.png

     文件        959  2018-09-13 09:27  QFileDialog\CustomFileDialog\CustomFileDialog\Resources\sysmin_hover.png

     文件   44433408  2018-09-18 19:58  QFileDialog\CustomFileDialog\CustomFileDialog.sdf

     文件        994  2018-09-18 19:23  QFileDialog\CustomFileDialog\CustomFileDialog.sln

    ..A..H.     34816  2018-09-18 19:58  QFileDialog\CustomFileDialog\CustomFileDialog.v12.suo

     目录          0  2019-01-16 14:18  QFileDialog\CustomFileDialog\CustomFileDialog\Resources

     目录          0  2019-01-09 14:52  QFileDialog\CustomFileDialog\build-CustomFileDialog-Desktop_Qt_5_6_3_MinGW_32bit-Debug

     目录          0  2019-01-16 14:18  QFileDialog\CustomFileDialog\CustomFileDialog

     目录          0  2019-01-16 14:18  QFileDialog\CustomFileDialog

     目录          0  2019-01-16 14:18  QFileDialog

----------- ---------  ---------- -----  ----

             44997491                    28

............此处省略1个文件信息

评论

共有 条评论