1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| #include<QtGui> #include "findfiledialog.h" #include "ui_findfiledialog.h" FindFileDialog::FindFileDialog(QWidget *parent) : QDialog(parent), ui(new Ui::FindFileDialog) { ui->setupUi(this); namedLabel = new QLabel(tr("&Named:"),this); namedLineEdit = new QLineEdit(this); namedLabel->setBuddy(namedLineEdit); lookInLabel = new QLabel(tr("&name"),this); lookInLineEdit = new QLineEdit(this); lookInLabel->setBuddy(lookInLineEdit); subfoldersCheckBox = new QCheckBox(tr("Include subfolders"),this); QStringList labels; labels << tr("Name") << tr("In Folder") << tr("Size") <<tr("Modified"); tableWidget = new QTableWidget(this); tableWidget->setColumnCount(4); tableWidget->setHorizontalHeaderLabels(labels); messageLabel = new QLabel(tr("0 files found"),this); messageLabel->setFrameShape(QLabel::Panel); messageLabel->setFrameShadow(QLabel::Sunken); findButton = new QPushButton(tr("&Find"),this); stopButton = new QPushButton(tr("Stop"),this); closeButton = new QPushButton(tr("Close"),this); helpButton = new QPushButton(tr("Help"),this); connect(closeButton,SIGNAL(clicked()),this,SLOT(close())); setWindowTitle(tr("Find Files or Folders")); setMinimumSize(265,190); resize(365,240); } FindFileDialog::~FindFileDialog() { delete ui; } void FindFileDialog::resizeEvent(QResizeEvent *) { int extraWidth = width()- minimumWidth(); int extraHeight = height() - minimumHeight(); namedLabel->setGeometry(9,9,50,25); namedLineEdit->setGeometry(65,9,100+extraWidth,25); lookInLabel->setGeometry(9,40,50,25); lookInLineEdit->setGeometry(65,40,100+extraWidth,25); subfoldersCheckBox->setGeometry(9,71,156+extraWidth,23); tableWidget->setGeometry(9,100,156 + extraWidth,50 + extraHeight); messageLabel->setGeometry(9,156 + extraHeight,156 + extraWidth,25); findButton->setGeometry(171 + extraWidth,9,85,32); stopButton->setGeometry(171 + extraWidth,47,85,32); closeButton->setGeometry(171 + extraWidth,84,85,32); helpButton->setGeometry(171 + extraWidth,149 + extraHeight,85,32); }
|