examples/dialogs/findfiles/window.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
    74     mainLayout->addWidget(textComboBox, 1, 1, 1, 2);
    74     mainLayout->addWidget(textComboBox, 1, 1, 1, 2);
    75     mainLayout->addWidget(directoryLabel, 2, 0);
    75     mainLayout->addWidget(directoryLabel, 2, 0);
    76     mainLayout->addWidget(directoryComboBox, 2, 1);
    76     mainLayout->addWidget(directoryComboBox, 2, 1);
    77     mainLayout->addWidget(browseButton, 2, 2);
    77     mainLayout->addWidget(browseButton, 2, 2);
    78     mainLayout->addWidget(filesTable, 3, 0, 1, 3);
    78     mainLayout->addWidget(filesTable, 3, 0, 1, 3);
    79     mainLayout->addWidget(filesFoundLabel, 4, 0);
    79     mainLayout->addWidget(filesFoundLabel, 4, 0, 1, 3);
    80     mainLayout->addLayout(buttonsLayout, 5, 0, 1, 3);
    80     mainLayout->addLayout(buttonsLayout, 5, 0, 1, 3);
    81     setLayout(mainLayout);
    81     setLayout(mainLayout);
    82 
    82 
    83     setWindowTitle(tr("Find Files"));
    83     setWindowTitle(tr("Find Files"));
    84     resize(700, 300);
    84     resize(700, 300);
   230     filesTable->setHorizontalHeaderLabels(labels);
   230     filesTable->setHorizontalHeaderLabels(labels);
   231     filesTable->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
   231     filesTable->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
   232     filesTable->verticalHeader()->hide();
   232     filesTable->verticalHeader()->hide();
   233     filesTable->setShowGrid(false);
   233     filesTable->setShowGrid(false);
   234 
   234 
   235     connect(filesTable, SIGNAL(cellActivated(int, int)),
   235     connect(filesTable, SIGNAL(cellActivated(int,int)),
   236             this, SLOT(openFileOfItem(int, int)));
   236             this, SLOT(openFileOfItem(int,int)));
   237 }
   237 }
   238 //! [11]
   238 //! [11]
   239 
   239 
   240 //! [12]
   240 //! [12]
   241 
   241 
   242 void Window::openFileOfItem(int row, int /* column */)
   242 void Window::openFileOfItem(int row, int /* column */)
   243 {
   243 {
   244     QTableWidgetItem *item = filesTable->item(row, 0);
   244     QTableWidgetItem *item = filesTable->item(row, 0);
   245 
   245 
   246     QDesktopServices::openUrl(currentDir.absoluteFilePath(item->text()));
   246     QDesktopServices::openUrl(QUrl::fromLocalFile(currentDir.absoluteFilePath(item->text())));
   247 }
   247 }
   248 
   248 
   249 //! [12]
   249 //! [12]
   250 
   250