QtWidgets tests: Replace qFindChild{ren} with QObject::findChild{ren}
Change-Id: I79a26387bcce0d7f79f4f9f70293e97dae52f949 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>bb10
parent
8d009b38c8
commit
f6e739d9e3
|
|
@ -247,7 +247,7 @@ void tst_QDialog::showMaximized()
|
|||
QDialog dialog(0);
|
||||
dialog.setSizeGripEnabled(true);
|
||||
#ifndef QT_NO_SIZEGRIP
|
||||
QSizeGrip *sizeGrip = qFindChild<QSizeGrip *>(&dialog);
|
||||
QSizeGrip *sizeGrip = dialog.findChild<QSizeGrip *>();
|
||||
QVERIFY(sizeGrip);
|
||||
#endif
|
||||
|
||||
|
|
@ -324,7 +324,7 @@ void tst_QDialog::showFullScreen()
|
|||
QDialog dialog(0, Qt::X11BypassWindowManagerHint);
|
||||
dialog.setSizeGripEnabled(true);
|
||||
#ifndef QT_NO_SIZEGRIP
|
||||
QSizeGrip *sizeGrip = qFindChild<QSizeGrip *>(&dialog);
|
||||
QSizeGrip *sizeGrip = dialog.findChild<QSizeGrip *>();
|
||||
QVERIFY(sizeGrip);
|
||||
#endif
|
||||
|
||||
|
|
@ -438,7 +438,7 @@ void tst_QDialog::showSizeGrip()
|
|||
QVERIFY(!dialog.isSizeGripEnabled());
|
||||
|
||||
dialog.setSizeGripEnabled(true);
|
||||
QPointer<QSizeGrip> sizeGrip = qFindChild<QSizeGrip *>(&dialog);
|
||||
QPointer<QSizeGrip> sizeGrip = dialog.findChild<QSizeGrip *>();
|
||||
QVERIFY(sizeGrip);
|
||||
QVERIFY(sizeGrip->isVisible());
|
||||
QVERIFY(dialog.isSizeGripEnabled());
|
||||
|
|
@ -456,7 +456,7 @@ void tst_QDialog::showSizeGrip()
|
|||
dialog.showExtension(false);
|
||||
QVERIFY(dialog.extension() && !dialog.extension()->isVisible());
|
||||
QVERIFY(dialog.isSizeGripEnabled());
|
||||
sizeGrip = qFindChild<QSizeGrip *>(&dialog);
|
||||
sizeGrip = dialog.findChild<QSizeGrip *>();
|
||||
QVERIFY(sizeGrip);
|
||||
QVERIFY(sizeGrip->isVisible());
|
||||
|
||||
|
|
@ -474,7 +474,7 @@ void tst_QDialog::showSizeGrip()
|
|||
QVERIFY(!dialog.isSizeGripEnabled());
|
||||
|
||||
dialog.setSizeGripEnabled(true);
|
||||
sizeGrip = qFindChild<QSizeGrip *>(&dialog);
|
||||
sizeGrip = dialog.findChild<QSizeGrip *>();
|
||||
QVERIFY(sizeGrip);
|
||||
QVERIFY(sizeGrip->isVisible());
|
||||
sizeGrip->hide();
|
||||
|
|
|
|||
|
|
@ -64,14 +64,14 @@ void tst_QErrorMessage::dontShowAgain()
|
|||
// show an error with plain string
|
||||
errorMessageDialog.showMessage(plainString);
|
||||
QVERIFY(errorMessageDialog.isVisible());
|
||||
checkBox = qFindChild<QCheckBox*>(&errorMessageDialog);
|
||||
checkBox = errorMessageDialog.findChild<QCheckBox*>();
|
||||
QVERIFY(checkBox);
|
||||
QVERIFY(checkBox->isChecked());
|
||||
errorMessageDialog.close();
|
||||
|
||||
errorMessageDialog.showMessage(plainString);
|
||||
QVERIFY(errorMessageDialog.isVisible());
|
||||
checkBox = qFindChild<QCheckBox*>(&errorMessageDialog);
|
||||
checkBox = errorMessageDialog.findChild<QCheckBox*>();
|
||||
QVERIFY(checkBox);
|
||||
QVERIFY(checkBox->isChecked());
|
||||
checkBox->setChecked(false);
|
||||
|
|
@ -83,7 +83,7 @@ void tst_QErrorMessage::dontShowAgain()
|
|||
// show an error with an html string
|
||||
errorMessageDialog.showMessage(htmlString);
|
||||
QVERIFY(errorMessageDialog.isVisible());
|
||||
checkBox = qFindChild<QCheckBox*>(&errorMessageDialog);
|
||||
checkBox = errorMessageDialog.findChild<QCheckBox*>();
|
||||
QVERIFY(checkBox);
|
||||
QVERIFY(!checkBox->isChecked());
|
||||
checkBox->setChecked(true);
|
||||
|
|
@ -91,7 +91,7 @@ void tst_QErrorMessage::dontShowAgain()
|
|||
|
||||
errorMessageDialog.showMessage(htmlString);
|
||||
QVERIFY(errorMessageDialog.isVisible());
|
||||
checkBox = qFindChild<QCheckBox*>(&errorMessageDialog);
|
||||
checkBox = errorMessageDialog.findChild<QCheckBox*>();
|
||||
QVERIFY(checkBox);
|
||||
QVERIFY(checkBox->isChecked());
|
||||
checkBox->setChecked(false);
|
||||
|
|
@ -111,7 +111,7 @@ void tst_QErrorMessage::dontShowCategoryAgain()
|
|||
|
||||
errorMessageDialog.showMessage(htmlString,"Cat 1");
|
||||
QVERIFY(errorMessageDialog.isVisible());
|
||||
checkBox = qFindChild<QCheckBox*>(&errorMessageDialog);
|
||||
checkBox = errorMessageDialog.findChild<QCheckBox*>();
|
||||
QVERIFY(checkBox);
|
||||
QVERIFY(checkBox->isChecked());
|
||||
checkBox->setChecked(true);
|
||||
|
|
@ -119,7 +119,7 @@ void tst_QErrorMessage::dontShowCategoryAgain()
|
|||
|
||||
errorMessageDialog.showMessage(htmlString,"Cat 1");
|
||||
QVERIFY(errorMessageDialog.isVisible());
|
||||
checkBox = qFindChild<QCheckBox*>(&errorMessageDialog);
|
||||
checkBox = errorMessageDialog.findChild<QCheckBox*>();
|
||||
QVERIFY(checkBox);
|
||||
QVERIFY(checkBox->isChecked());
|
||||
checkBox->setChecked(true);
|
||||
|
|
@ -127,7 +127,7 @@ void tst_QErrorMessage::dontShowCategoryAgain()
|
|||
|
||||
errorMessageDialog.showMessage(htmlString2,"Cat 1");
|
||||
QVERIFY(errorMessageDialog.isVisible());
|
||||
checkBox = qFindChild<QCheckBox*>(&errorMessageDialog);
|
||||
checkBox = errorMessageDialog.findChild<QCheckBox*>();
|
||||
QVERIFY(checkBox);
|
||||
QVERIFY(checkBox->isChecked());
|
||||
checkBox->setChecked(true);
|
||||
|
|
@ -135,7 +135,7 @@ void tst_QErrorMessage::dontShowCategoryAgain()
|
|||
|
||||
errorMessageDialog.showMessage(htmlString,"Cat 1");
|
||||
QVERIFY(errorMessageDialog.isVisible());
|
||||
checkBox = qFindChild<QCheckBox*>(&errorMessageDialog);
|
||||
checkBox = errorMessageDialog.findChild<QCheckBox*>();
|
||||
QVERIFY(checkBox);
|
||||
QVERIFY(checkBox->isChecked());
|
||||
checkBox->setChecked(false);
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ void tst_QFiledialog::currentChangedSignal()
|
|||
fd.setViewMode(QFileDialog::List);
|
||||
QSignalSpy spyCurrentChanged(&fd, SIGNAL(currentChanged(QString)));
|
||||
|
||||
QListView* listView = qFindChild<QListView*>(&fd, "listView");
|
||||
QListView* listView = fd.findChild<QListView*>("listView");
|
||||
QVERIFY(listView);
|
||||
fd.setDirectory(QDir::root());
|
||||
QModelIndex root = listView->rootIndex();
|
||||
|
|
@ -229,14 +229,14 @@ void tst_QFiledialog::directoryEnteredSignal()
|
|||
QSignalSpy spyDirectoryEntered(&fd, SIGNAL(directoryEntered(QString)));
|
||||
|
||||
// sidebar
|
||||
QSidebar *sidebar = qFindChild<QSidebar*>(&fd, "sidebar");
|
||||
QSidebar *sidebar = fd.findChild<QSidebar*>("sidebar");
|
||||
sidebar->setCurrentIndex(sidebar->model()->index(1, 0));
|
||||
QTest::keyPress(sidebar->viewport(), Qt::Key_Return);
|
||||
QCOMPARE(spyDirectoryEntered.count(), 1);
|
||||
spyDirectoryEntered.clear();
|
||||
|
||||
// lookInCombo
|
||||
QComboBox *comboBox = qFindChild<QComboBox*>(&fd, "lookInCombo");
|
||||
QComboBox *comboBox = fd.findChild<QComboBox*>("lookInCombo");
|
||||
comboBox->showPopup();
|
||||
QVERIFY(comboBox->view()->model()->index(1, 0).isValid());
|
||||
comboBox->view()->setCurrentIndex(comboBox->view()->model()->index(1, 0));
|
||||
|
|
@ -248,7 +248,7 @@ void tst_QFiledialog::directoryEnteredSignal()
|
|||
/*
|
||||
// platform specific
|
||||
fd.setViewMode(QFileDialog::ViewMode(QFileDialog::List));
|
||||
QListView* listView = qFindChild<QListView*>(&fd, "listView");
|
||||
QListView* listView = fd.findChild<QListView*>("listView");
|
||||
QVERIFY(listView);
|
||||
QModelIndex root = listView->rootIndex();
|
||||
QTRY_COMPARE(listView->model()->rowCount(root) > 0, true);
|
||||
|
|
@ -293,7 +293,7 @@ void tst_QFiledialog::filesSelectedSignal()
|
|||
|
||||
fd.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&fd));
|
||||
QListView *listView = qFindChild<QListView*>(&fd, "listView");
|
||||
QListView *listView = fd.findChild<QListView*>("listView");
|
||||
QVERIFY(listView);
|
||||
|
||||
QModelIndex root = listView->rootIndex();
|
||||
|
|
@ -314,7 +314,7 @@ void tst_QFiledialog::filesSelectedSignal()
|
|||
listView->selectionModel()->select(file, QItemSelectionModel::Select | QItemSelectionModel::Rows);
|
||||
listView->setCurrentIndex(file);
|
||||
|
||||
QDialogButtonBox *buttonBox = qFindChild<QDialogButtonBox*>(&fd, "buttonBox");
|
||||
QDialogButtonBox *buttonBox = fd.findChild<QDialogButtonBox*>("buttonBox");
|
||||
QPushButton *button = buttonBox->button(QDialogButtonBox::Open);
|
||||
QVERIFY(button);
|
||||
QVERIFY(button->isEnabled());
|
||||
|
|
@ -338,7 +338,7 @@ void tst_QFiledialog::filterSelectedSignal()
|
|||
fd.setNameFilters(filterChoices);
|
||||
QCOMPARE(fd.nameFilters(), filterChoices);
|
||||
|
||||
QComboBox *filters = qFindChild<QComboBox*>(&fd, "fileTypeCombo");
|
||||
QComboBox *filters = fd.findChild<QComboBox*>("fileTypeCombo");
|
||||
QVERIFY(filters);
|
||||
QVERIFY(filters->view());
|
||||
QCOMPARE(filters->isVisible(), true);
|
||||
|
|
@ -367,7 +367,7 @@ void tst_QFiledialog::directory()
|
|||
{
|
||||
QNonNativeFileDialog fd;
|
||||
fd.setViewMode(QFileDialog::List);
|
||||
QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
|
||||
QFileSystemModel *model = fd.findChild<QFileSystemModel*>("qt_filesystem_model");
|
||||
QVERIFY(model);
|
||||
fd.setDirectory(QDir::currentPath());
|
||||
QSignalSpy spyCurrentChanged(&fd, SIGNAL(currentChanged(QString)));
|
||||
|
|
@ -392,7 +392,7 @@ void tst_QFiledialog::directory()
|
|||
QCOMPARE(spyFilterSelected.count(), 0);
|
||||
|
||||
// Check my way
|
||||
QList<QListView*> list = qFindChildren<QListView*>(&fd, "listView");
|
||||
QList<QListView*> list = fd.findChildren<QListView*>("listView");
|
||||
QVERIFY(list.count() > 0);
|
||||
#ifdef Q_OS_WIN
|
||||
QCOMPARE(list.at(0)->rootIndex().data().toString().toLower(), temp.dirName().toLower());
|
||||
|
|
@ -476,9 +476,9 @@ void tst_QFiledialog::completer()
|
|||
fd.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&fd));
|
||||
QVERIFY(fd.isVisible());
|
||||
QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
|
||||
QFileSystemModel *model = fd.findChild<QFileSystemModel*>("qt_filesystem_model");
|
||||
QVERIFY(model);
|
||||
QLineEdit *lineEdit = qFindChild<QLineEdit*>(&fd, "fileNameEdit");
|
||||
QLineEdit *lineEdit = fd.findChild<QLineEdit*>("fileNameEdit");
|
||||
QVERIFY(lineEdit);
|
||||
QCompleter *completer = lineEdit->completer();
|
||||
QVERIFY(completer);
|
||||
|
|
@ -567,7 +567,7 @@ void tst_QFiledialog::completer_up()
|
|||
QSignalSpy spyFilterSelected(&fd, SIGNAL(filterSelected(QString)));
|
||||
|
||||
fd.show();
|
||||
QLineEdit *lineEdit = qFindChild<QLineEdit*>(&fd, "fileNameEdit");
|
||||
QLineEdit *lineEdit = fd.findChild<QLineEdit*>("fileNameEdit");
|
||||
QVERIFY(lineEdit);
|
||||
QCOMPARE(spyFilesSelected.count(), 0);
|
||||
int depth = QDir::currentPath().split('/').count();
|
||||
|
|
@ -586,7 +586,7 @@ void tst_QFiledialog::acceptMode()
|
|||
QNonNativeFileDialog fd;
|
||||
fd.show();
|
||||
|
||||
QToolButton* newButton = qFindChild<QToolButton*>(&fd, "newFolderButton");
|
||||
QToolButton* newButton = fd.findChild<QToolButton*>("newFolderButton");
|
||||
QVERIFY(newButton);
|
||||
|
||||
// default
|
||||
|
|
@ -658,7 +658,7 @@ void tst_QFiledialog::filters()
|
|||
QCOMPARE(fd.nameFilters(), QStringList("All Files (*)"));
|
||||
|
||||
// effects
|
||||
QList<QComboBox*> views = qFindChildren<QComboBox*>(&fd, "fileTypeCombo");
|
||||
QList<QComboBox*> views = fd.findChildren<QComboBox*>("fileTypeCombo");
|
||||
QVERIFY(views.count() == 1);
|
||||
QCOMPARE(views.at(0)->isVisible(), false);
|
||||
|
||||
|
|
@ -728,7 +728,7 @@ void tst_QFiledialog::history()
|
|||
{
|
||||
QNonNativeFileDialog fd;
|
||||
fd.setViewMode(QFileDialog::List);
|
||||
QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
|
||||
QFileSystemModel *model = fd.findChild<QFileSystemModel*>("qt_filesystem_model");
|
||||
QVERIFY(model);
|
||||
QSignalSpy spyCurrentChanged(&fd, SIGNAL(currentChanged(QString)));
|
||||
QSignalSpy spyDirectoryEntered(&fd, SIGNAL(directoryEntered(QString)));
|
||||
|
|
@ -744,7 +744,7 @@ void tst_QFiledialog::history()
|
|||
if (fd.history() != history) {
|
||||
qDebug() << fd.history() << history;
|
||||
// quick and dirty output for windows failure.
|
||||
QListView* list = qFindChild<QListView*>(&fd, "listView");
|
||||
QListView* list = fd.findChild<QListView*>("listView");
|
||||
QVERIFY(list);
|
||||
QModelIndex root = list->rootIndex();
|
||||
while (root.isValid()) {
|
||||
|
|
@ -781,9 +781,9 @@ void tst_QFiledialog::isReadOnly()
|
|||
{
|
||||
QNonNativeFileDialog fd;
|
||||
|
||||
QPushButton* newButton = qFindChild<QPushButton*>(&fd, "newFolderButton");
|
||||
QAction* renameAction = qFindChild<QAction*>(&fd, "qt_rename_action");
|
||||
QAction* deleteAction = qFindChild<QAction*>(&fd, "qt_delete_action");
|
||||
QPushButton* newButton = fd.findChild<QPushButton*>("newFolderButton");
|
||||
QAction* renameAction = fd.findChild<QAction*>("qt_rename_action");
|
||||
QAction* deleteAction = fd.findChild<QAction*>("qt_delete_action");
|
||||
|
||||
QCOMPARE(fd.isReadOnly(), false);
|
||||
|
||||
|
|
@ -862,7 +862,7 @@ void tst_QFiledialog::selectFile()
|
|||
QFETCH(QString, file);
|
||||
QFETCH(int, count);
|
||||
QNonNativeFileDialog fd;
|
||||
QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
|
||||
QFileSystemModel *model = fd.findChild<QFileSystemModel*>("qt_filesystem_model");
|
||||
QVERIFY(model);
|
||||
fd.setDirectory(QDir::currentPath());
|
||||
// default value
|
||||
|
|
@ -912,7 +912,7 @@ void tst_QFiledialog::selectFiles()
|
|||
QStringList list = fd.directory().entryList(QDir::Files);
|
||||
QModelIndexList toSelect;
|
||||
QVERIFY(list.count() > 1);
|
||||
QListView* listView = qFindChild<QListView*>(&fd, "listView");
|
||||
QListView* listView = fd.findChild<QListView*>("listView");
|
||||
QVERIFY(listView);
|
||||
for (int i = 0; i < list.count(); ++i) {
|
||||
fd.selectFile(fd.directory().path() + "/" + list.at(i));
|
||||
|
|
@ -945,7 +945,7 @@ void tst_QFiledialog::selectFiles()
|
|||
dialog->selectFile(temporary);
|
||||
dialog->show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(dialog));
|
||||
QLineEdit *lineEdit = qFindChild<QLineEdit*>(dialog, "fileNameEdit");
|
||||
QLineEdit *lineEdit = dialog->findChild<QLineEdit*>("fileNameEdit");
|
||||
QVERIFY(lineEdit);
|
||||
QCOMPARE(lineEdit->text(),QLatin1String("blah"));
|
||||
delete dialog;
|
||||
|
|
@ -958,13 +958,13 @@ void tst_QFiledialog::viewMode()
|
|||
fd.show();
|
||||
|
||||
// find widgets
|
||||
QList<QTreeView*> treeView = qFindChildren<QTreeView*>(&fd, "treeView");
|
||||
QList<QTreeView*> treeView = fd.findChildren<QTreeView*>("treeView");
|
||||
QCOMPARE(treeView.count(), 1);
|
||||
QList<QListView*> listView = qFindChildren<QListView*>(&fd, "listView");
|
||||
QList<QListView*> listView = fd.findChildren<QListView*>("listView");
|
||||
QCOMPARE(listView.count(), 1);
|
||||
QList<QToolButton*> listButton = qFindChildren<QToolButton*>(&fd, "listModeButton");
|
||||
QList<QToolButton*> listButton = fd.findChildren<QToolButton*>("listModeButton");
|
||||
QCOMPARE(listButton.count(), 1);
|
||||
QList<QToolButton*> treeButton = qFindChildren<QToolButton*>(&fd, "detailModeButton");
|
||||
QList<QToolButton*> treeButton = fd.findChildren<QToolButton*>("detailModeButton");
|
||||
QCOMPARE(treeButton.count(), 1);
|
||||
|
||||
// default value
|
||||
|
|
@ -1069,7 +1069,7 @@ void tst_QFiledialog::focus()
|
|||
// make sure the tests work with focus follows mouse
|
||||
QCursor::setPos(fd.geometry().center());
|
||||
|
||||
QList<QWidget*> treeView = qFindChildren<QWidget*>(&fd, "fileNameEdit");
|
||||
QList<QWidget*> treeView = fd.findChildren<QWidget*>("fileNameEdit");
|
||||
QCOMPARE(treeView.count(), 1);
|
||||
QVERIFY(treeView.at(0));
|
||||
QTRY_COMPARE(treeView.at(0)->hasFocus(), true);
|
||||
|
|
@ -1080,11 +1080,11 @@ void tst_QFiledialog::focus()
|
|||
void tst_QFiledialog::historyBack()
|
||||
{
|
||||
QNonNativeFileDialog fd;
|
||||
QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
|
||||
QFileSystemModel *model = fd.findChild<QFileSystemModel*>("qt_filesystem_model");
|
||||
QVERIFY(model);
|
||||
QToolButton *backButton = qFindChild<QToolButton*>(&fd, "backButton");
|
||||
QToolButton *backButton = fd.findChild<QToolButton*>("backButton");
|
||||
QVERIFY(backButton);
|
||||
QToolButton *forwardButton = qFindChild<QToolButton*>(&fd, "forwardButton");
|
||||
QToolButton *forwardButton = fd.findChild<QToolButton*>("forwardButton");
|
||||
QVERIFY(forwardButton);
|
||||
|
||||
QSignalSpy spy(model, SIGNAL(rootPathChanged(QString)));
|
||||
|
|
@ -1128,12 +1128,12 @@ void tst_QFiledialog::historyForward()
|
|||
{
|
||||
QNonNativeFileDialog fd;
|
||||
fd.setDirectory(QDir::currentPath());
|
||||
QToolButton *backButton = qFindChild<QToolButton*>(&fd, "backButton");
|
||||
QToolButton *backButton = fd.findChild<QToolButton*>("backButton");
|
||||
QVERIFY(backButton);
|
||||
QToolButton *forwardButton = qFindChild<QToolButton*>(&fd, "forwardButton");
|
||||
QToolButton *forwardButton = fd.findChild<QToolButton*>("forwardButton");
|
||||
QVERIFY(forwardButton);
|
||||
|
||||
QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
|
||||
QFileSystemModel *model = fd.findChild<QFileSystemModel*>("qt_filesystem_model");
|
||||
QVERIFY(model);
|
||||
QSignalSpy spy(model, SIGNAL(rootPathChanged(QString)));
|
||||
|
||||
|
|
@ -1204,7 +1204,7 @@ void tst_QFiledialog::disableSaveButton()
|
|||
|
||||
QNonNativeFileDialog fd(0, "caption", path);
|
||||
fd.setAcceptMode(QFileDialog::AcceptSave);
|
||||
QDialogButtonBox *buttonBox = qFindChild<QDialogButtonBox*>(&fd, "buttonBox");
|
||||
QDialogButtonBox *buttonBox = fd.findChild<QDialogButtonBox*>("buttonBox");
|
||||
QPushButton *button = buttonBox->button(QDialogButtonBox::Save);
|
||||
QVERIFY(button);
|
||||
QCOMPARE(button->isEnabled(), isEnabled);
|
||||
|
|
@ -1235,7 +1235,7 @@ void tst_QFiledialog::saveButtonText()
|
|||
fd.setLabelText(QFileDialog::Accept, label);
|
||||
fd.setDirectory(QDir::temp());
|
||||
fd.selectFile(path);
|
||||
QDialogButtonBox *buttonBox = qFindChild<QDialogButtonBox*>(&fd, "buttonBox");
|
||||
QDialogButtonBox *buttonBox = fd.findChild<QDialogButtonBox*>("buttonBox");
|
||||
QVERIFY(buttonBox);
|
||||
QPushButton *button = buttonBox->button(QDialogButtonBox::Save);
|
||||
QVERIFY(button);
|
||||
|
|
@ -1253,12 +1253,12 @@ void tst_QFiledialog::clearLineEdit()
|
|||
//play it really safe by creating a directory
|
||||
QDir::home().mkdir("_____aaaaaaaaaaaaaaaaaaaaaa");
|
||||
|
||||
QLineEdit *lineEdit = qFindChild<QLineEdit*>(&fd, "fileNameEdit");
|
||||
QLineEdit *lineEdit = fd.findChild<QLineEdit*>("fileNameEdit");
|
||||
QVERIFY(lineEdit);
|
||||
QVERIFY(lineEdit->text() == "foo");
|
||||
fd.setDirectory(QDir::home());
|
||||
|
||||
QListView* list = qFindChild<QListView*>(&fd, "listView");
|
||||
QListView* list = fd.findChild<QListView*>("listView");
|
||||
QVERIFY(list);
|
||||
|
||||
// saving a file the text shouldn't be cleared
|
||||
|
|
@ -1308,7 +1308,7 @@ void tst_QFiledialog::enableChooseButton()
|
|||
QNonNativeFileDialog fd;
|
||||
fd.setFileMode(QFileDialog::Directory);
|
||||
fd.show();
|
||||
QDialogButtonBox *buttonBox = qFindChild<QDialogButtonBox*>(&fd, "buttonBox");
|
||||
QDialogButtonBox *buttonBox = fd.findChild<QDialogButtonBox*>("buttonBox");
|
||||
QPushButton *button = buttonBox->button(QDialogButtonBox::Open);
|
||||
QVERIFY(button);
|
||||
QCOMPARE(button->isEnabled(), true);
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ void tst_QFileDialog2::deleteDirAndFiles()
|
|||
void tst_QFileDialog2::filter()
|
||||
{
|
||||
QNonNativeFileDialog fd;
|
||||
QAction *hiddenAction = qFindChild<QAction*>(&fd, "qt_show_hidden_action");
|
||||
QAction *hiddenAction = fd.findChild<QAction*>("qt_show_hidden_action");
|
||||
QVERIFY(hiddenAction);
|
||||
QVERIFY(hiddenAction->isEnabled());
|
||||
QVERIFY(!hiddenAction->isChecked());
|
||||
|
|
@ -270,7 +270,7 @@ void tst_QFileDialog2::filter()
|
|||
void tst_QFileDialog2::showNameFilterDetails()
|
||||
{
|
||||
QNonNativeFileDialog fd;
|
||||
QComboBox *filters = qFindChild<QComboBox*>(&fd, "fileTypeCombo");
|
||||
QComboBox *filters = fd.findChild<QComboBox*>("fileTypeCombo");
|
||||
QVERIFY(filters);
|
||||
QVERIFY(fd.isNameFilterDetailsVisible());
|
||||
|
||||
|
|
@ -302,7 +302,7 @@ void tst_QFileDialog2::unc()
|
|||
#endif
|
||||
QVERIFY(QFile::exists(dir));
|
||||
QNonNativeFileDialog fd(0, QString(), dir);
|
||||
QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
|
||||
QFileSystemModel *model = fd.findChild<QFileSystemModel*>("qt_filesystem_model");
|
||||
QVERIFY(model);
|
||||
QCOMPARE(model->index(fd.directory().absolutePath()), model->index(dir));
|
||||
}
|
||||
|
|
@ -311,12 +311,12 @@ void tst_QFileDialog2::emptyUncPath()
|
|||
{
|
||||
QNonNativeFileDialog fd;
|
||||
fd.show();
|
||||
QLineEdit *lineEdit = qFindChild<QLineEdit*>(&fd, "fileNameEdit");
|
||||
QLineEdit *lineEdit = fd.findChild<QLineEdit*>("fileNameEdit");
|
||||
QVERIFY(lineEdit);
|
||||
// press 'keys' for the input
|
||||
for (int i = 0; i < 3 ; ++i)
|
||||
QTest::keyPress(lineEdit, Qt::Key_Backslash);
|
||||
QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
|
||||
QFileSystemModel *model = fd.findChild<QFileSystemModel*>("qt_filesystem_model");
|
||||
QVERIFY(model);
|
||||
}
|
||||
|
||||
|
|
@ -327,7 +327,7 @@ struct MenuCloser : public QObject {
|
|||
|
||||
void close()
|
||||
{
|
||||
QMenu *menu = qFindChild<QMenu*>(w);
|
||||
QMenu *menu = w->findChild<QMenu*>();
|
||||
if (!menu) {
|
||||
qDebug("%s: cannot find file dialog child of type QMenu", Q_FUNC_INFO);
|
||||
w->close();
|
||||
|
|
@ -337,7 +337,7 @@ struct MenuCloser : public QObject {
|
|||
};
|
||||
static bool openContextMenu(QFileDialog &fd)
|
||||
{
|
||||
QListView *list = qFindChild<QListView*>(&fd, "listView");
|
||||
QListView *list = fd.findChild<QListView*>("listView");
|
||||
if (!list) {
|
||||
qDebug("%s: didn't find file dialog child \"listView\"", Q_FUNC_INFO);
|
||||
return false;
|
||||
|
|
@ -386,9 +386,9 @@ void tst_QFileDialog2::task143519_deleteAndRenameActionBehavior()
|
|||
QTest::qWaitForWindowActive(&fd);
|
||||
|
||||
// grab some internals:
|
||||
QAction *rm = qFindChild<QAction*>(&fd, "qt_delete_action");
|
||||
QAction *rm = fd.findChild<QAction*>("qt_delete_action");
|
||||
QVERIFY(rm);
|
||||
QAction *mv = qFindChild<QAction*>(&fd, "qt_rename_action");
|
||||
QAction *mv = fd.findChild<QAction*>("qt_rename_action");
|
||||
QVERIFY(mv);
|
||||
|
||||
// these are the real test cases:
|
||||
|
|
@ -458,7 +458,7 @@ void tst_QFileDialog2::task180459_lastDirectory()
|
|||
{
|
||||
//first visit the temp directory and close the dialog
|
||||
QNonNativeFileDialog *dlg = new QNonNativeFileDialog(0, "", tempDir.path());
|
||||
QFileSystemModel *model = qFindChild<QFileSystemModel*>(dlg, "qt_filesystem_model");
|
||||
QFileSystemModel *model = dlg->findChild<QFileSystemModel*>("qt_filesystem_model");
|
||||
QVERIFY(model);
|
||||
QCOMPARE(model->index(tempDir.path()), model->index(dlg->directory().absolutePath()));
|
||||
delete dlg;
|
||||
|
|
@ -469,12 +469,12 @@ void tst_QFileDialog2::task180459_lastDirectory()
|
|||
QFETCH(QString, result);
|
||||
|
||||
dlg = new QNonNativeFileDialog(0, "", path);
|
||||
model = qFindChild<QFileSystemModel*>(dlg, "qt_filesystem_model");
|
||||
model = dlg->findChild<QFileSystemModel*>("qt_filesystem_model");
|
||||
QVERIFY(model);
|
||||
dlg->setAcceptMode(QFileDialog::AcceptSave);
|
||||
QCOMPARE(model->index(dlg->directory().absolutePath()), model->index(directory));
|
||||
|
||||
QDialogButtonBox *buttonBox = qFindChild<QDialogButtonBox*>(dlg, "buttonBox");
|
||||
QDialogButtonBox *buttonBox = dlg->findChild<QDialogButtonBox*>("buttonBox");
|
||||
QPushButton *button = buttonBox->button(QDialogButtonBox::Save);
|
||||
QVERIFY(button);
|
||||
QCOMPARE(button->isEnabled(), isEnabled);
|
||||
|
|
@ -564,7 +564,7 @@ void tst_QFileDialog2::task227304_proxyOnFileDialog()
|
|||
QNonNativeFileDialog fd(0, "", QDir::currentPath(), 0);
|
||||
fd.setProxyModel(new FilterDirModel(QDir::currentPath()));
|
||||
fd.show();
|
||||
QLineEdit *edit = qFindChild<QLineEdit*>(&fd, "fileNameEdit");
|
||||
QLineEdit *edit = fd.findChild<QLineEdit*>("fileNameEdit");
|
||||
QTest::qWait(200);
|
||||
QTest::keyClick(edit, Qt::Key_T);
|
||||
QTest::keyClick(edit, Qt::Key_S);
|
||||
|
|
@ -575,7 +575,7 @@ void tst_QFileDialog2::task227304_proxyOnFileDialog()
|
|||
dialog->setFileMode(QFileDialog::ExistingFile);
|
||||
dialog->show();
|
||||
|
||||
QListView *list = qFindChild<QListView*>(dialog, "listView");
|
||||
QListView *list = dialog->findChild<QListView*>("listView");
|
||||
QTest::qWait(200);
|
||||
QTest::keyClick(list, Qt::Key_Down);
|
||||
QTest::keyClick(list, Qt::Key_Return);
|
||||
|
|
@ -588,7 +588,7 @@ void tst_QFileDialog2::task227304_proxyOnFileDialog()
|
|||
QSortFilterProxyModel *pm = new QSortFilterProxyModel;
|
||||
fd2.setProxyModel(pm);
|
||||
fd2.show();
|
||||
QSidebar *sidebar = qFindChild<QSidebar*>(&fd2, "sidebar");
|
||||
QSidebar *sidebar = fd2.findChild<QSidebar*>("sidebar");
|
||||
sidebar->setFocus();
|
||||
sidebar->selectUrl(QUrl::fromLocalFile(QDir::homePath()));
|
||||
QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(1, 0)).center());
|
||||
|
|
@ -616,7 +616,7 @@ void tst_QFileDialog2::task227930_correctNavigationKeyboardBehavior()
|
|||
fd.setViewMode(QFileDialog::List);
|
||||
fd.setDirectory(current.absolutePath());
|
||||
fd.show();
|
||||
QListView *list = qFindChild<QListView*>(&fd, "listView");
|
||||
QListView *list = fd.findChild<QListView*>("listView");
|
||||
QTest::qWait(200);
|
||||
QTest::keyClick(list, Qt::Key_Down);
|
||||
QTest::keyClick(list, Qt::Key_Return);
|
||||
|
|
@ -646,8 +646,8 @@ void tst_QFileDialog2::task226366_lowerCaseHardDriveWindows()
|
|||
QNonNativeFileDialog fd;
|
||||
fd.setDirectory(QDir::root().path());
|
||||
fd.show();
|
||||
QLineEdit *edit = qFindChild<QLineEdit*>(&fd, "fileNameEdit");
|
||||
QToolButton *buttonParent = qFindChild<QToolButton*>(&fd, "toParentButton");
|
||||
QLineEdit *edit = fd.findChild<QLineEdit*>("fileNameEdit");
|
||||
QToolButton *buttonParent = fd.findChild<QToolButton*>("toParentButton");
|
||||
QTest::qWait(200);
|
||||
QTest::mouseClick(buttonParent, Qt::LeftButton,0,QPoint(0,0));
|
||||
QTest::qWait(2000);
|
||||
|
|
@ -712,7 +712,7 @@ void tst_QFileDialog2::completionOnLevelAfterRoot()
|
|||
QSKIP("This test requires to have an etc directory under /");
|
||||
#endif
|
||||
fd.show();
|
||||
QLineEdit *edit = qFindChild<QLineEdit*>(&fd, "fileNameEdit");
|
||||
QLineEdit *edit = fd.findChild<QLineEdit*>("fileNameEdit");
|
||||
QTest::qWait(2000);
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
//I love testlib :D
|
||||
|
|
@ -741,14 +741,14 @@ void tst_QFileDialog2::task233037_selectingDirectory()
|
|||
fd.setDirectory(current.absolutePath());
|
||||
fd.setAcceptMode( QFileDialog::AcceptSave);
|
||||
fd.show();
|
||||
QListView *list = qFindChild<QListView*>(&fd, "listView");
|
||||
QListView *list = fd.findChild<QListView*>("listView");
|
||||
QTest::qWait(3000); // Wait for sort to settle (I need a signal).
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
list->setEditFocus(true);
|
||||
#endif
|
||||
QTest::keyClick(list, Qt::Key_Down);
|
||||
QTest::qWait(100);
|
||||
QDialogButtonBox *buttonBox = qFindChild<QDialogButtonBox*>(&fd, "buttonBox");
|
||||
QDialogButtonBox *buttonBox = fd.findChild<QDialogButtonBox*>("buttonBox");
|
||||
QPushButton *button = buttonBox->button(QDialogButtonBox::Save);
|
||||
QVERIFY(button);
|
||||
QCOMPARE(button->isEnabled(), true);
|
||||
|
|
@ -763,7 +763,7 @@ void tst_QFileDialog2::task235069_hideOnEscape()
|
|||
fd.setDirectory(current.absolutePath());
|
||||
fd.setAcceptMode( QFileDialog::AcceptSave);
|
||||
fd.show();
|
||||
QListView *list = qFindChild<QListView*>(&fd, "listView");
|
||||
QListView *list = fd.findChild<QListView*>("listView");
|
||||
list->setFocus();
|
||||
QTest::qWait(200);
|
||||
QTest::keyClick(list, Qt::Key_Escape);
|
||||
|
|
@ -772,7 +772,7 @@ void tst_QFileDialog2::task235069_hideOnEscape()
|
|||
fd2.setDirectory(current.absolutePath());
|
||||
fd2.setAcceptMode( QFileDialog::AcceptSave);
|
||||
fd2.show();
|
||||
QLineEdit *edit = qFindChild<QLineEdit*>(&fd2, "fileNameEdit");
|
||||
QLineEdit *edit = fd2.findChild<QLineEdit*>("fileNameEdit");
|
||||
QTest::keyClick(edit, Qt::Key_Escape);
|
||||
QCOMPARE(fd2.isVisible(), false);
|
||||
}
|
||||
|
|
@ -789,7 +789,7 @@ void tst_QFileDialog2::task236402_dontWatchDeletedDir()
|
|||
fd.setDirectory(current.absolutePath());
|
||||
fd.setAcceptMode( QFileDialog::AcceptSave);
|
||||
fd.show();
|
||||
QListView *list = qFindChild<QListView*>(&fd, "listView");
|
||||
QListView *list = fd.findChild<QListView*>("listView");
|
||||
list->setFocus();
|
||||
QTest::qWait(200);
|
||||
QTest::keyClick(list, Qt::Key_Return);
|
||||
|
|
@ -812,12 +812,12 @@ void tst_QFileDialog2::task203703_returnProperSeparator()
|
|||
fd.setFileMode(QFileDialog::Directory);
|
||||
fd.show();
|
||||
QTest::qWait(500);
|
||||
QListView *list = qFindChild<QListView*>(&fd, "listView");
|
||||
QListView *list = fd.findChild<QListView*>("listView");
|
||||
list->setFocus();
|
||||
QTest::qWait(200);
|
||||
QTest::keyClick(list, Qt::Key_Return);
|
||||
QTest::qWait(1000);
|
||||
QDialogButtonBox *buttonBox = qFindChild<QDialogButtonBox*>(&fd, "buttonBox");
|
||||
QDialogButtonBox *buttonBox = fd.findChild<QDialogButtonBox*>("buttonBox");
|
||||
QPushButton *button = buttonBox->button(QDialogButtonBox::Cancel);
|
||||
QTest::keyClick(button, Qt::Key_Return);
|
||||
QTest::qWait(500);
|
||||
|
|
@ -852,10 +852,10 @@ void tst_QFileDialog2::task228844_ensurePreviousSorting()
|
|||
#else
|
||||
QTest::qWait(500);
|
||||
#endif
|
||||
QTreeView *tree = qFindChild<QTreeView*>(&fd, "treeView");
|
||||
QTreeView *tree = fd.findChild<QTreeView*>("treeView");
|
||||
tree->header()->setSortIndicator(3,Qt::DescendingOrder);
|
||||
QTest::qWait(200);
|
||||
QDialogButtonBox *buttonBox = qFindChild<QDialogButtonBox*>(&fd, "buttonBox");
|
||||
QDialogButtonBox *buttonBox = fd.findChild<QDialogButtonBox*>("buttonBox");
|
||||
QPushButton *button = buttonBox->button(QDialogButtonBox::Open);
|
||||
QTest::mouseClick(button, Qt::LeftButton);
|
||||
#if defined(Q_OS_WINCE)
|
||||
|
|
@ -874,12 +874,12 @@ void tst_QFileDialog2::task228844_ensurePreviousSorting()
|
|||
#else
|
||||
QTest::qWait(500);
|
||||
#endif
|
||||
QTreeView *tree2 = qFindChild<QTreeView*>(&fd2, "treeView");
|
||||
QTreeView *tree2 = fd2.findChild<QTreeView*>("treeView");
|
||||
tree2->setFocus();
|
||||
|
||||
QCOMPARE(tree2->rootIndex().data(QFileSystemModel::FilePathRole).toString(),current.absolutePath());
|
||||
|
||||
QDialogButtonBox *buttonBox2 = qFindChild<QDialogButtonBox*>(&fd2, "buttonBox");
|
||||
QDialogButtonBox *buttonBox2 = fd2.findChild<QDialogButtonBox*>("buttonBox");
|
||||
QPushButton *button2 = buttonBox2->button(QDialogButtonBox::Open);
|
||||
fd2.selectFile("g");
|
||||
QTest::mouseClick(button2, Qt::LeftButton);
|
||||
|
|
@ -899,12 +899,12 @@ void tst_QFileDialog2::task228844_ensurePreviousSorting()
|
|||
#else
|
||||
QTest::qWait(500);
|
||||
#endif
|
||||
QTreeView *tree3 = qFindChild<QTreeView*>(&fd3, "treeView");
|
||||
QTreeView *tree3 = fd3.findChild<QTreeView*>("treeView");
|
||||
tree3->setFocus();
|
||||
|
||||
QCOMPARE(tree3->rootIndex().data(QFileSystemModel::FilePathRole).toString(), current.absolutePath());
|
||||
|
||||
QDialogButtonBox *buttonBox3 = qFindChild<QDialogButtonBox*>(&fd3, "buttonBox");
|
||||
QDialogButtonBox *buttonBox3 = fd3.findChild<QDialogButtonBox*>("buttonBox");
|
||||
QPushButton *button3 = buttonBox3->button(QDialogButtonBox::Open);
|
||||
QTest::mouseClick(button3, Qt::LeftButton);
|
||||
#if defined(Q_OS_WINCE)
|
||||
|
|
@ -988,7 +988,7 @@ void tst_QFileDialog2::task251321_sideBarHiddenEntries()
|
|||
fd.show();
|
||||
QTest::qWait(250);
|
||||
|
||||
QSidebar *sidebar = qFindChild<QSidebar*>(&fd, "sidebar");
|
||||
QSidebar *sidebar = fd.findChild<QSidebar*>("sidebar");
|
||||
sidebar->setFocus();
|
||||
sidebar->selectUrl(QUrl::fromLocalFile(hiddenSubDir.absolutePath()));
|
||||
QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(0, 0)).center());
|
||||
|
|
@ -999,7 +999,7 @@ void tst_QFileDialog2::task251321_sideBarHiddenEntries()
|
|||
QTest::qWait(250);
|
||||
#endif
|
||||
|
||||
QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
|
||||
QFileSystemModel *model = fd.findChild<QFileSystemModel*>("qt_filesystem_model");
|
||||
QCOMPARE(model->rowCount(model->index(hiddenSubDir.absolutePath())), 2);
|
||||
|
||||
hiddenSubDir.rmdir("happy2");
|
||||
|
|
@ -1045,14 +1045,14 @@ void tst_QFileDialog2::task251341_sideBarRemoveEntries()
|
|||
fd.show();
|
||||
QTest::qWait(250);
|
||||
|
||||
QSidebar *sidebar = qFindChild<QSidebar*>(&fd, "sidebar");
|
||||
QSidebar *sidebar = fd.findChild<QSidebar*>("sidebar");
|
||||
sidebar->setFocus();
|
||||
//We enter in the first bookmark
|
||||
sidebar->selectUrl(QUrl::fromLocalFile(testSubDir.absolutePath()));
|
||||
QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(0, 0)).center());
|
||||
QTest::qWait(250);
|
||||
|
||||
QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
|
||||
QFileSystemModel *model = fd.findChild<QFileSystemModel*>("qt_filesystem_model");
|
||||
//There is no file
|
||||
QCOMPARE(model->rowCount(model->index(testSubDir.absolutePath())), 0);
|
||||
//Icon is not enabled QUrlModel::EnabledRole
|
||||
|
|
@ -1116,10 +1116,10 @@ void tst_QFileDialog2::task254490_selectFileMultipleTimes()
|
|||
fd.show();
|
||||
QTest::qWait(250);
|
||||
|
||||
QLineEdit *lineEdit = qFindChild<QLineEdit*>(&fd, "fileNameEdit");
|
||||
QLineEdit *lineEdit = fd.findChild<QLineEdit*>("fileNameEdit");
|
||||
QVERIFY(lineEdit);
|
||||
QCOMPARE(lineEdit->text(),QLatin1String("new_file.txt"));
|
||||
QListView *list = qFindChild<QListView*>(&fd, "listView");
|
||||
QListView *list = fd.findChild<QListView*>("listView");
|
||||
QVERIFY(list);
|
||||
QCOMPARE(list->selectionModel()->selectedRows(0).count(), 0);
|
||||
|
||||
|
|
@ -1136,7 +1136,7 @@ void tst_QFileDialog2::task257579_sideBarWithNonCleanUrls()
|
|||
QString url = QString::fromLatin1("%1/%2/..").arg(dir.absolutePath()).arg(dirname);
|
||||
QNonNativeFileDialog fd;
|
||||
fd.setSidebarUrls(QList<QUrl>() << QUrl::fromLocalFile(url));
|
||||
QSidebar *sidebar = qFindChild<QSidebar*>(&fd, "sidebar");
|
||||
QSidebar *sidebar = fd.findChild<QSidebar*>("sidebar");
|
||||
QCOMPARE(sidebar->urls().count(), 1);
|
||||
QVERIFY(sidebar->urls().first().toLocalFile() != url);
|
||||
QCOMPARE(sidebar->urls().first().toLocalFile(), QDir::cleanPath(url));
|
||||
|
|
@ -1161,7 +1161,7 @@ void tst_QFileDialog2::task259105_filtersCornerCases()
|
|||
QTest::qWait(250);
|
||||
|
||||
//Extensions are hidden
|
||||
QComboBox *filters = qFindChild<QComboBox*>(&fd, "fileTypeCombo");
|
||||
QComboBox *filters = fd.findChild<QComboBox*>("fileTypeCombo");
|
||||
QVERIFY(filters);
|
||||
QCOMPARE(filters->currentText(), QLatin1String("All Files!"));
|
||||
filters->setCurrentIndex(1);
|
||||
|
|
@ -1215,7 +1215,7 @@ void tst_QFileDialog2::QTBUG4419_lineEditSelectAll()
|
|||
QCOMPARE(fd.isVisible(), true);
|
||||
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
|
||||
|
||||
QLineEdit *lineEdit = qFindChild<QLineEdit*>(&fd, "fileNameEdit");
|
||||
QLineEdit *lineEdit = fd.findChild<QLineEdit*>("fileNameEdit");
|
||||
QVERIFY(lineEdit);
|
||||
|
||||
QTRY_COMPARE(tempPath + QChar('/') + lineEdit->text(), t->fileName());
|
||||
|
|
@ -1258,7 +1258,7 @@ void tst_QFileDialog2::QTBUG6558_showDirsOnly()
|
|||
QCOMPARE(fd.isVisible(), true);
|
||||
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
|
||||
|
||||
QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
|
||||
QFileSystemModel *model = fd.findChild<QFileSystemModel*>("qt_filesystem_model");
|
||||
QTRY_COMPARE(model->rowCount(model->index(dir.absolutePath())), 2);
|
||||
|
||||
fd.setOption(QFileDialog::ShowDirsOnly, false);
|
||||
|
|
@ -1306,7 +1306,7 @@ void tst_QFileDialog2::QTBUG4842_selectFilterWithHideNameFilterDetails()
|
|||
QCOMPARE(fd.isVisible(), true);
|
||||
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
|
||||
|
||||
QComboBox *filters = qFindChild<QComboBox*>(&fd, "fileTypeCombo");
|
||||
QComboBox *filters = fd.findChild<QComboBox*>("fileTypeCombo");
|
||||
//We compare the current combobox text with the stripped version
|
||||
QCOMPARE(filters->currentText(), QString("Text files"));
|
||||
|
||||
|
|
@ -1322,7 +1322,7 @@ void tst_QFileDialog2::QTBUG4842_selectFilterWithHideNameFilterDetails()
|
|||
QCOMPARE(fd2.isVisible(), true);
|
||||
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd2));
|
||||
|
||||
QComboBox *filters2 = qFindChild<QComboBox*>(&fd2, "fileTypeCombo");
|
||||
QComboBox *filters2 = fd2.findChild<QComboBox*>("fileTypeCombo");
|
||||
//We compare the current combobox text with the non stripped version
|
||||
QCOMPARE(filters2->currentText(), chosenFilterString);
|
||||
|
||||
|
|
@ -1340,7 +1340,7 @@ void tst_QFileDialog2::dontShowCompleterOnRoot()
|
|||
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
|
||||
|
||||
fd.setDirectory("");
|
||||
QLineEdit *lineEdit = qFindChild<QLineEdit*>(&fd, "fileNameEdit");
|
||||
QLineEdit *lineEdit = fd.findChild<QLineEdit*>("fileNameEdit");
|
||||
QTRY_VERIFY(lineEdit->text().isEmpty());
|
||||
|
||||
//The gatherer thread will then return the result
|
||||
|
|
|
|||
|
|
@ -153,13 +153,13 @@ void testInvalidateAndRestore(
|
|||
template <typename SpinBoxType, typename ValueType>
|
||||
void testGetNumeric(QInputDialog *dialog, SpinBoxType * = 0, ValueType * = 0)
|
||||
{
|
||||
SpinBoxType *sbox = qFindChild<SpinBoxType *>(dialog);
|
||||
SpinBoxType *sbox = dialog->findChild<SpinBoxType *>();
|
||||
QVERIFY(sbox != 0);
|
||||
|
||||
QLineEdit *ledit = qFindChild<QLineEdit *>(static_cast<QObject *>(sbox));
|
||||
QLineEdit *ledit = static_cast<QObject *>(sbox)->findChild<QLineEdit *>();
|
||||
QVERIFY(ledit != 0);
|
||||
|
||||
QDialogButtonBox *bbox = qFindChild<QDialogButtonBox *>(dialog);
|
||||
QDialogButtonBox *bbox = dialog->findChild<QDialogButtonBox *>();
|
||||
QVERIFY(bbox != 0);
|
||||
QPushButton *okButton = bbox->button(QDialogButtonBox::Ok);
|
||||
QVERIFY(okButton != 0);
|
||||
|
|
@ -189,10 +189,10 @@ void testGetNumeric(QInputDialog *dialog, SpinBoxType * = 0, ValueType * = 0)
|
|||
|
||||
void testGetText(QInputDialog *dialog)
|
||||
{
|
||||
QLineEdit *ledit = qFindChild<QLineEdit *>(dialog);
|
||||
QLineEdit *ledit = dialog->findChild<QLineEdit *>();
|
||||
QVERIFY(ledit);
|
||||
|
||||
QDialogButtonBox *bbox = qFindChild<QDialogButtonBox *>(dialog);
|
||||
QDialogButtonBox *bbox = dialog->findChild<QDialogButtonBox *>();
|
||||
QVERIFY(bbox);
|
||||
QPushButton *okButton = bbox->button(QDialogButtonBox::Ok);
|
||||
QVERIFY(okButton);
|
||||
|
|
@ -207,10 +207,10 @@ void testGetText(QInputDialog *dialog)
|
|||
|
||||
void testGetItem(QInputDialog *dialog)
|
||||
{
|
||||
QComboBox *cbox = qFindChild<QComboBox *>(dialog);
|
||||
QComboBox *cbox = dialog->findChild<QComboBox *>();
|
||||
QVERIFY(cbox);
|
||||
|
||||
QDialogButtonBox *bbox = qFindChild<QDialogButtonBox *>(dialog);
|
||||
QDialogButtonBox *bbox = dialog->findChild<QDialogButtonBox *>();
|
||||
QVERIFY(bbox);
|
||||
QPushButton *okButton = bbox->button(QDialogButtonBox::Ok);
|
||||
QVERIFY(okButton);
|
||||
|
|
@ -245,7 +245,7 @@ void tst_QInputDialog::testFuncGetItem(QInputDialog *dialog)
|
|||
void tst_QInputDialog::timerEvent(QTimerEvent *event)
|
||||
{
|
||||
killTimer(event->timerId());
|
||||
QInputDialog *dialog = qFindChild<QInputDialog *>(parent);
|
||||
QInputDialog *dialog = parent->findChild<QInputDialog *>();
|
||||
QVERIFY(dialog);
|
||||
if (testFunc)
|
||||
testFunc(dialog);
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ void tst_QProgressDialog::task198202()
|
|||
QProgressDialog dlg(QLatin1String("test"),QLatin1String("test"),1,10);
|
||||
dlg.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&dlg));
|
||||
int futureHeight = dlg.sizeHint().height() - qFindChild<QLabel*>(&dlg)->sizeHint().height();
|
||||
int futureHeight = dlg.sizeHint().height() - dlg.findChild<QLabel*>()->sizeHint().height();
|
||||
dlg.setLabel(0);
|
||||
QTest::ignoreMessage(QtWarningMsg, "QProgressDialog::setBar: Cannot set a null progress bar");
|
||||
dlg.setBar(0);
|
||||
|
|
|
|||
|
|
@ -2518,7 +2518,7 @@ void tst_QWizard::task161658_alignments()
|
|||
wizard.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&wizard));
|
||||
|
||||
foreach (QLabel *subtitleLabel, qFindChildren<QLabel *>(&wizard)) {
|
||||
foreach (QLabel *subtitleLabel, wizard.findChildren<QLabel *>()) {
|
||||
if (subtitleLabel->text().startsWith("SUBTITLE#")) {
|
||||
QCOMPARE(lineEdit1.mapToGlobal(lineEdit1.contentsRect().bottomRight()).x(),
|
||||
subtitleLabel->mapToGlobal(subtitleLabel->contentsRect().bottomRight()).x());
|
||||
|
|
|
|||
|
|
@ -3081,7 +3081,7 @@ protected:
|
|||
private slots:
|
||||
void checkMenu()
|
||||
{
|
||||
if (qFindChild<QMenu *>(this))
|
||||
if (this->findChild<QMenu *>())
|
||||
embeddedPopup = true;
|
||||
hide();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -845,7 +845,7 @@ void tst_QGraphicsView::dragMode_rubberBand()
|
|||
QCOMPARE(view.verticalScrollBar()->value(), verticalScrollBarValue);
|
||||
|
||||
// We don't use QRubberBand as of 4.3; the band is drawn internally.
|
||||
QVERIFY(!qFindChild<QRubberBand *>(&view));
|
||||
QVERIFY(!view.findChild<QRubberBand *>());
|
||||
|
||||
QTest::qWait(25);
|
||||
|
||||
|
|
|
|||
|
|
@ -742,7 +742,7 @@ void tst_QAbstractItemView::persistentEditorFocus()
|
|||
view.openPersistentEditor(model.index(0, 2));
|
||||
|
||||
//these are spinboxes because we put numbers inside
|
||||
QList<QSpinBox*> list = qFindChildren<QSpinBox*>(view.viewport());
|
||||
QList<QSpinBox*> list = view.viewport()->findChildren<QSpinBox*>();
|
||||
QCOMPARE(list.count(), 2); //these should be the 2 editors
|
||||
|
||||
view.setCurrentIndex(model.index(0, 0));
|
||||
|
|
@ -1270,21 +1270,21 @@ void tst_QAbstractItemView::task257481_emptyEditor()
|
|||
treeView.show();
|
||||
|
||||
treeView.edit(model.index(0,0));
|
||||
QList<QLineEdit *> lineEditors = qFindChildren<QLineEdit *>(treeView.viewport());
|
||||
QList<QLineEdit *> lineEditors = treeView.viewport()->findChildren<QLineEdit *>();
|
||||
QCOMPARE(lineEditors.count(), 1);
|
||||
QVERIFY(!lineEditors.first()->size().isEmpty());
|
||||
|
||||
QTest::qWait(30);
|
||||
|
||||
treeView.edit(model.index(1,0));
|
||||
lineEditors = qFindChildren<QLineEdit *>(treeView.viewport());
|
||||
lineEditors = treeView.viewport()->findChildren<QLineEdit *>();
|
||||
QCOMPARE(lineEditors.count(), 1);
|
||||
QVERIFY(!lineEditors.first()->size().isEmpty());
|
||||
|
||||
QTest::qWait(30);
|
||||
|
||||
treeView.edit(model.index(2,0));
|
||||
lineEditors = qFindChildren<QLineEdit *>(treeView.viewport());
|
||||
lineEditors = treeView.viewport()->findChildren<QLineEdit *>();
|
||||
QCOMPARE(lineEditors.count(), 1);
|
||||
QVERIFY(!lineEditors.first()->size().isEmpty());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -365,7 +365,7 @@ void tst_QItemDelegate::editorKeyPress()
|
|||
view.setCurrentIndex(index); // the editor will only selectAll on the current index
|
||||
view.edit(index);
|
||||
|
||||
QList<QLineEdit*> lineEditors = qFindChildren<QLineEdit *>(view.viewport());
|
||||
QList<QLineEdit*> lineEditors = view.viewport()->findChildren<QLineEdit *>();
|
||||
QCOMPARE(lineEditors.count(), 1);
|
||||
|
||||
QLineEdit *editor = lineEditors.at(0);
|
||||
|
|
@ -394,7 +394,7 @@ void tst_QItemDelegate::doubleEditorNegativeInput()
|
|||
view.setCurrentIndex(index); // the editor will only selectAll on the current index
|
||||
view.edit(index);
|
||||
|
||||
QList<QDoubleSpinBox*> editors = qFindChildren<QDoubleSpinBox *>(view.viewport());
|
||||
QList<QDoubleSpinBox*> editors = view.viewport()->findChildren<QDoubleSpinBox *>();
|
||||
QCOMPARE(editors.count(), 1);
|
||||
|
||||
QDoubleSpinBox *editor = editors.at(0);
|
||||
|
|
@ -776,7 +776,7 @@ void tst_QItemDelegate::dateTimeEditor()
|
|||
|
||||
QTestEventLoop::instance().enterLoop(1);
|
||||
|
||||
QTimeEdit *timeEditor = qFindChild<QTimeEdit *>(widget.viewport());
|
||||
QTimeEdit *timeEditor = widget.viewport()->findChild<QTimeEdit *>();
|
||||
QVERIFY(timeEditor);
|
||||
QCOMPARE(timeEditor->time(), time);
|
||||
// The data must actually be different in order for the model
|
||||
|
|
@ -790,7 +790,7 @@ void tst_QItemDelegate::dateTimeEditor()
|
|||
|
||||
QTestEventLoop::instance().enterLoop(1);
|
||||
|
||||
QDateEdit *dateEditor = qFindChild<QDateEdit *>(widget.viewport());
|
||||
QDateEdit *dateEditor = widget.viewport()->findChild<QDateEdit *>();
|
||||
QVERIFY(dateEditor);
|
||||
QCOMPARE(dateEditor->date(), date);
|
||||
dateEditor->setDate(date.addDays(60));
|
||||
|
|
@ -1312,7 +1312,7 @@ void tst_QItemDelegate::enterKey()
|
|||
view.edit(index);
|
||||
QTest::qWait(30);
|
||||
|
||||
QList<QWidget*> lineEditors = qFindChildren<QWidget *>(view.viewport(), QString::fromLatin1("TheEditor"));
|
||||
QList<QWidget*> lineEditors = view.viewport()->findChildren<QWidget *>(QString::fromLatin1("TheEditor"));
|
||||
QCOMPARE(lineEditors.count(), 1);
|
||||
|
||||
QPointer<QWidget> editor = lineEditors.at(0);
|
||||
|
|
@ -1344,7 +1344,7 @@ void tst_QItemDelegate::task257859_finalizeEdit()
|
|||
view.edit(index);
|
||||
QTest::qWait(30);
|
||||
|
||||
QList<QLineEdit *> lineEditors = qFindChildren<QLineEdit *>(view.viewport());
|
||||
QList<QLineEdit *> lineEditors = view.viewport()->findChildren<QLineEdit *>();
|
||||
QCOMPARE(lineEditors.count(), 1);
|
||||
|
||||
QPointer<QWidget> editor = lineEditors.at(0);
|
||||
|
|
@ -1397,7 +1397,7 @@ void tst_QItemDelegate::comboBox()
|
|||
|
||||
QTestEventLoop::instance().enterLoop(1);
|
||||
|
||||
QComboBox *boolEditor = qFindChild<QComboBox*>(widget.viewport());
|
||||
QComboBox *boolEditor = widget.viewport()->findChild<QComboBox*>();
|
||||
QVERIFY(boolEditor);
|
||||
QCOMPARE(boolEditor->currentIndex(), 1); // True is selected initially.
|
||||
// The data must actually be different in order for the model
|
||||
|
|
|
|||
|
|
@ -3727,7 +3727,7 @@ void tst_QTableView::addColumnWhileEditing()
|
|||
//let's see if the editor is moved to the right location
|
||||
//after adding a column
|
||||
model.setColumnCount(model.columnCount() + 1);
|
||||
QPointer<QLineEdit> editor = qFindChild<QLineEdit*>(&view);
|
||||
QPointer<QLineEdit> editor = view.findChild<QLineEdit*>();
|
||||
QVERIFY(editor);
|
||||
QCOMPARE(editor->geometry(), view.visualRect(last));
|
||||
|
||||
|
|
|
|||
|
|
@ -819,7 +819,7 @@ void tst_QTreeView::editTriggers()
|
|||
view.setCurrentIndex(view.model()->index(0, 0));
|
||||
|
||||
// Verify that we don't have any editor initially
|
||||
QVERIFY(!qFindChild<QLineEdit *>(&view, QString()));
|
||||
QVERIFY(!view.findChild<QLineEdit *>(QString()));
|
||||
|
||||
// Set the triggers
|
||||
view.setEditTriggers(editTriggers);
|
||||
|
|
@ -865,7 +865,7 @@ void tst_QTreeView::editTriggers()
|
|||
#ifdef Q_OS_MAC
|
||||
QEXPECT_FAIL("EditKeyPressed 4", "QTBUG-23696", Continue);
|
||||
#endif
|
||||
QTRY_COMPARE(qFindChild<QLineEdit *>(&view, QString()) != 0, editorOpened);
|
||||
QTRY_COMPARE(view.findChild<QLineEdit *>(QString()) != 0, editorOpened);
|
||||
}
|
||||
|
||||
void tst_QTreeView::hasAutoScroll()
|
||||
|
|
@ -1228,15 +1228,15 @@ void tst_QTreeView::openPersistentEditor()
|
|||
view.setModel(&treeModel);
|
||||
view.show();
|
||||
|
||||
QVERIFY(!qFindChild<QLineEdit *>(view.viewport()));
|
||||
QVERIFY(!view.viewport()->findChild<QLineEdit *>());
|
||||
view.openPersistentEditor(view.model()->index(0, 0));
|
||||
QVERIFY(qFindChild<QLineEdit *>(view.viewport()));
|
||||
QVERIFY(view.viewport()->findChild<QLineEdit *>());
|
||||
|
||||
view.closePersistentEditor(view.model()->index(0, 0));
|
||||
QVERIFY(!qFindChild<QLineEdit *>(view.viewport())->isVisible());
|
||||
QVERIFY(!view.viewport()->findChild<QLineEdit *>()->isVisible());
|
||||
|
||||
qApp->sendPostedEvents(0, QEvent::DeferredDelete);
|
||||
QVERIFY(!qFindChild<QLineEdit *>(view.viewport()));
|
||||
QVERIFY(!view.viewport()->findChild<QLineEdit *>());
|
||||
}
|
||||
|
||||
void tst_QTreeView::rootIndex()
|
||||
|
|
|
|||
|
|
@ -467,7 +467,7 @@ void tst_QTreeWidget::editItem()
|
|||
tree.editItem(item, col);
|
||||
QApplication::instance()->processEvents();
|
||||
QApplication::instance()->processEvents();
|
||||
QLineEdit *editor = qFindChild<QLineEdit*>(&tree);
|
||||
QLineEdit *editor = tree.findChild<QLineEdit*>();
|
||||
if (editor) {
|
||||
QVERIFY(item->flags() & Qt::ItemIsEditable);
|
||||
QCOMPARE(editor->selectedText(), editor->text());
|
||||
|
|
@ -2079,7 +2079,7 @@ void tst_QTreeWidget::itemWidget()
|
|||
// ### should you really be able to open a persistent
|
||||
// editor for an item that isn't editable??
|
||||
tree.openPersistentEditor(item, col);
|
||||
QWidget *editor = qFindChild<QLineEdit*>(&tree);
|
||||
QWidget *editor = tree.findChild<QLineEdit*>();
|
||||
QVERIFY(editor != 0);
|
||||
tree.closePersistentEditor(item, col);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1241,7 +1241,7 @@ public slots:
|
|||
|
||||
void DeleteLaterWidget::runTest()
|
||||
{
|
||||
QObject *stillAlive = qFindChild<QObject*>(this, "deleteLater");
|
||||
QObject *stillAlive = this->findChild<QObject*>("deleteLater");
|
||||
|
||||
QWidget *w = new QWidget(this);
|
||||
connect(w, SIGNAL(destroyed()), this, SLOT(childDeleted()));
|
||||
|
|
@ -1287,7 +1287,7 @@ void tst_QApplication::testDeleteLater()
|
|||
object->setObjectName("deleteLater");
|
||||
object->deleteLater();
|
||||
|
||||
QObject *stillAlive = qFindChild<QObject*>(wgt, "deleteLater");
|
||||
QObject *stillAlive = wgt->findChild<QObject*>("deleteLater");
|
||||
QVERIFY(stillAlive);
|
||||
|
||||
app.exec();
|
||||
|
|
|
|||
|
|
@ -6130,7 +6130,7 @@ static void workaroundPaletteIssue(QWidget *widget)
|
|||
if (!widget)
|
||||
return;
|
||||
|
||||
QWidget *navigationBar = qFindChild<QWidget *>(widget, QLatin1String("qt_calendar_navigationbar"));
|
||||
QWidget *navigationBar = widget->findChild<QWidget *>(QLatin1String("qt_calendar_navigationbar"));
|
||||
QVERIFY(navigationBar);
|
||||
|
||||
QPalette palette = navigationBar->palette();
|
||||
|
|
@ -6229,7 +6229,7 @@ void tst_QWidget::renderInvisible()
|
|||
}
|
||||
|
||||
// Get navigation bar and explicitly hide it.
|
||||
QWidget *navigationBar = qFindChild<QWidget *>(calendar.data(), QLatin1String("qt_calendar_navigationbar"));
|
||||
QWidget *navigationBar = calendar.data()->findChild<QWidget *>(QLatin1String("qt_calendar_navigationbar"));
|
||||
QVERIFY(navigationBar);
|
||||
navigationBar->hide();
|
||||
|
||||
|
|
@ -6252,7 +6252,7 @@ void tst_QWidget::renderInvisible()
|
|||
}
|
||||
|
||||
// Get next month button.
|
||||
QWidget *nextMonthButton = qFindChild<QWidget *>(navigationBar, QLatin1String("qt_calendar_nextmonth"));
|
||||
QWidget *nextMonthButton = navigationBar->findChild<QWidget *>(QLatin1String("qt_calendar_nextmonth"));
|
||||
QVERIFY(nextMonthButton);
|
||||
|
||||
{ // Render next month button.
|
||||
|
|
|
|||
|
|
@ -689,7 +689,7 @@ void tst_QStyle::lineUpLayoutTest(QStyle *style)
|
|||
widget.setLayout(&layout);
|
||||
widget.setStyle(style);
|
||||
// propagate the style.
|
||||
foreach (QWidget *w, qFindChildren<QWidget *>(&widget))
|
||||
foreach (QWidget *w, widget.findChildren<QWidget *>())
|
||||
w->setStyle(style);
|
||||
widget.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
||||
|
|
|
|||
|
|
@ -656,7 +656,7 @@ void tst_QStyleSheetStyle::fontPropagation()
|
|||
QTabWidget tw;
|
||||
tw.setStyleSheet("QTabWidget { font-size: 20pt; }");
|
||||
QVERIFY(FONTSIZE(tw) == 20);
|
||||
QWidget *child = qFindChild<QWidget *>(&tw, "qt_tabwidget_tabbar");
|
||||
QWidget *child = tw.findChild<QWidget *>("qt_tabwidget_tabbar");
|
||||
QVERIFY2(child, "QTabWidget did not contain a widget named \"qt_tabwidget_tabbar\"");
|
||||
QVERIFY(FONTSIZE(*child) == 20);
|
||||
}
|
||||
|
|
@ -957,7 +957,7 @@ void tst_QStyleSheetStyle::tabAlignement()
|
|||
tabWidget.resize(QSize(400,400));
|
||||
topLevel.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&topLevel));
|
||||
QTabBar *bar = qFindChild<QTabBar*>(&tabWidget);
|
||||
QTabBar *bar = tabWidget.findChild<QTabBar*>();
|
||||
QVERIFY(bar);
|
||||
//check the tab is on the right
|
||||
tabWidget.setStyleSheet("QTabWidget::tab-bar { alignment: right ; }");
|
||||
|
|
@ -1030,7 +1030,7 @@ void tst_QStyleSheetStyle::minmaxSizes()
|
|||
QVERIFY(qAbs(page3->maximumSize().height() - 500 - 2) <= 2);
|
||||
QVERIFY(qAbs(page3->minimumSize().height() - 250 - 2) <= 2);
|
||||
QVERIFY(qAbs(page3->minimumSize().height() - 250 - 2) <= 2);
|
||||
QTabBar *bar = qFindChild<QTabBar*>(&tabWidget);
|
||||
QTabBar *bar = tabWidget.findChild<QTabBar*>();
|
||||
QVERIFY(bar);
|
||||
#ifdef Q_OS_MAC
|
||||
QEXPECT_FAIL("", "QTBUG-23686", Continue);
|
||||
|
|
|
|||
|
|
@ -183,24 +183,24 @@ void tst_QCalendarWidget::buttonClickCheck()
|
|||
QDate selectedDate(2005, 1, 1);
|
||||
//click on the month buttons
|
||||
int month = object.monthShown();
|
||||
QToolButton *button = qFindChild<QToolButton *>(&object, "qt_calendar_prevmonth");
|
||||
QToolButton *button = object.findChild<QToolButton *>("qt_calendar_prevmonth");
|
||||
QTest::mouseClick(button, Qt::LeftButton);
|
||||
QCOMPARE(month > 1 ? month-1 : 12, object.monthShown());
|
||||
button = qFindChild<QToolButton *>(&object, "qt_calendar_nextmonth");
|
||||
button = object.findChild<QToolButton *>("qt_calendar_nextmonth");
|
||||
QTest::mouseClick(button, Qt::LeftButton);
|
||||
QCOMPARE(month, object.monthShown());
|
||||
|
||||
button = qFindChild<QToolButton *>(&object, "qt_calendar_yearbutton");
|
||||
button = object.findChild<QToolButton *>("qt_calendar_yearbutton");
|
||||
QTest::mouseClick(button, Qt::LeftButton, Qt::NoModifier, button->rect().center(), 2);
|
||||
QVERIFY(!button->isVisible());
|
||||
QSpinBox *spinbox = qFindChild<QSpinBox *>(&object, "qt_calendar_yearedit");
|
||||
QSpinBox *spinbox = object.findChild<QSpinBox *>("qt_calendar_yearedit");
|
||||
QTest::qWait(500);
|
||||
QTest::keyClick(spinbox, '2');
|
||||
QTest::keyClick(spinbox, '0');
|
||||
QTest::keyClick(spinbox, '0');
|
||||
QTest::keyClick(spinbox, '6');
|
||||
QTest::qWait(500);
|
||||
QWidget *widget = qFindChild<QWidget *>(&object, "qt_calendar_calendarview");
|
||||
QWidget *widget = object.findChild<QWidget *>("qt_calendar_calendarview");
|
||||
QTest::mouseMove(widget);
|
||||
QTest::mouseClick(widget, Qt::LeftButton);
|
||||
QCOMPARE(2006, object.yearShown());
|
||||
|
|
@ -212,11 +212,11 @@ void tst_QCalendarWidget::buttonClickCheck()
|
|||
object.setDateRange(QDate(2006,1,1), QDate(2006,2,28));
|
||||
object.setSelectedDate(QDate(2006,1,1));
|
||||
object.showSelectedDate();
|
||||
button = qFindChild<QToolButton *>(&object, "qt_calendar_prevmonth");
|
||||
button = object.findChild<QToolButton *>("qt_calendar_prevmonth");
|
||||
QTest::mouseClick(button, Qt::LeftButton);
|
||||
QCOMPARE(1, object.monthShown());
|
||||
|
||||
button = qFindChild<QToolButton *>(&object, "qt_calendar_nextmonth");
|
||||
button = object.findChild<QToolButton *>("qt_calendar_nextmonth");
|
||||
QTest::mouseClick(button, Qt::LeftButton);
|
||||
QCOMPARE(2, object.monthShown());
|
||||
QTest::mouseClick(button, Qt::LeftButton);
|
||||
|
|
@ -351,7 +351,7 @@ void tst_QCalendarWidget::showPrevNext()
|
|||
|
||||
// QTBUG-4058
|
||||
QTest::qWait(20);
|
||||
QToolButton *button = qFindChild<QToolButton *>(&calWidget, "qt_calendar_prevmonth");
|
||||
QToolButton *button = calWidget.findChild<QToolButton *>("qt_calendar_prevmonth");
|
||||
QTest::mouseClick(button, Qt::LeftButton);
|
||||
expectedDate = expectedDate.addMonths(-1);
|
||||
QCOMPARE(calWidget.yearShown(), expectedDate.year());
|
||||
|
|
|
|||
|
|
@ -2064,10 +2064,10 @@ void tst_QComboBox::task190351_layout()
|
|||
QApplication::processEvents();
|
||||
|
||||
#ifdef QT_BUILD_INTERNAL
|
||||
QFrame *container = qFindChild<QComboBoxPrivateContainer *>(&listCombo);
|
||||
QFrame *container = listCombo.findChild<QComboBoxPrivateContainer *>();
|
||||
QVERIFY(container);
|
||||
QCOMPARE(static_cast<QAbstractItemView *>(list), qFindChild<QAbstractItemView *>(container));
|
||||
QWidget *top = qFindChild<QComboBoxPrivateScroller *>(container);
|
||||
QCOMPARE(static_cast<QAbstractItemView *>(list), container->findChild<QAbstractItemView *>());
|
||||
QWidget *top = container->findChild<QComboBoxPrivateScroller *>();
|
||||
QVERIFY(top);
|
||||
QVERIFY(top->isVisible());
|
||||
QCOMPARE(top->mapToGlobal(QPoint(0, top->height())).y(), list->mapToGlobal(QPoint()).y());
|
||||
|
|
@ -2138,10 +2138,10 @@ void tst_QComboBox::task191329_size()
|
|||
QTRY_VERIFY(tableCombo.view()->isVisible());
|
||||
|
||||
#ifdef QT_BUILD_INTERNAL
|
||||
QFrame *container = qFindChild<QComboBoxPrivateContainer *>(&tableCombo);
|
||||
QFrame *container = tableCombo.findChild<QComboBoxPrivateContainer *>();
|
||||
QVERIFY(container);
|
||||
QCOMPARE(static_cast<QAbstractItemView *>(table), qFindChild<QAbstractItemView *>(container));
|
||||
foreach (QWidget *button, qFindChildren<QComboBoxPrivateScroller *>(container)) {
|
||||
QCOMPARE(static_cast<QAbstractItemView *>(table), container->findChild<QAbstractItemView *>());
|
||||
foreach (QWidget *button, container->findChildren<QComboBoxPrivateScroller *>()) {
|
||||
//the popup should be large enough to contains everithing so the top and left button are hidden
|
||||
QVERIFY(!button->isVisible());
|
||||
}
|
||||
|
|
@ -2201,7 +2201,7 @@ void tst_QComboBox::task248169_popupWithMinimalSize()
|
|||
QTRY_VERIFY(comboBox.view()->isVisible());
|
||||
|
||||
#ifdef QT_BUILD_INTERNAL
|
||||
QFrame *container = qFindChild<QComboBoxPrivateContainer *>(&comboBox);
|
||||
QFrame *container = comboBox.findChild<QComboBoxPrivateContainer *>();
|
||||
QVERIFY(container);
|
||||
QTRY_VERIFY(desktop.screenGeometry(container).contains(container->geometry()));
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -2818,7 +2818,7 @@ void tst_QDateTimeEdit::calendarPopup()
|
|||
opt.subControls = QStyle::SC_ComboBoxArrow;
|
||||
QRect rect = style->subControlRect(QStyle::CC_ComboBox, &opt, QStyle::SC_ComboBoxArrow, testWidget);
|
||||
QTest::mouseClick(testWidget, Qt::LeftButton, 0, QPoint(rect.left()+rect.width()/2, rect.top()+rect.height()/2));
|
||||
QWidget *wid = qFindChild<QWidget *>(testWidget, "qt_datetimedit_calendar");
|
||||
QWidget *wid = testWidget->findChild<QWidget *>("qt_datetimedit_calendar");
|
||||
QVERIFY(wid != 0);
|
||||
testWidget->hide();
|
||||
|
||||
|
|
@ -2830,7 +2830,7 @@ void tst_QDateTimeEdit::calendarPopup()
|
|||
opt.subControls = QStyle::SC_ComboBoxArrow;
|
||||
rect = style->subControlRect(QStyle::CC_ComboBox, &opt, QStyle::SC_ComboBoxArrow, &timeEdit);
|
||||
QTest::mouseClick(&timeEdit, Qt::LeftButton, 0, QPoint(rect.left()+rect.width()/2, rect.top()+rect.height()/2));
|
||||
QWidget *wid2 = qFindChild<QWidget *>(&timeEdit, "qt_datetimedit_calendar");
|
||||
QWidget *wid2 = timeEdit.findChild<QWidget *>("qt_datetimedit_calendar");
|
||||
QVERIFY(wid2 == 0);
|
||||
timeEdit.hide();
|
||||
|
||||
|
|
@ -2844,7 +2844,7 @@ void tst_QDateTimeEdit::calendarPopup()
|
|||
opt.subControls = QStyle::SC_ComboBoxArrow;
|
||||
rect = style->subControlRect(QStyle::CC_ComboBox, &opt, QStyle::SC_ComboBoxArrow, &dateEdit);
|
||||
QTest::mouseClick(&dateEdit, Qt::LeftButton, 0, QPoint(rect.left()+rect.width()/2, rect.top()+rect.height()/2));
|
||||
QWidget *wid3 = qFindChild<QWidget *>(&dateEdit, "qt_datetimedit_calendar");
|
||||
QWidget *wid3 = dateEdit.findChild<QWidget *>("qt_datetimedit_calendar");
|
||||
QVERIFY(wid3 == 0);
|
||||
dateEdit.hide();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ void tst_QDialogButtonBox::addButton1()
|
|||
QPushButton *button = new QPushButton();
|
||||
buttonBox.addButton(button, role);
|
||||
QTEST(buttonBox.buttons().count(), "totalCount");
|
||||
QList<QAbstractButton *> children = qFindChildren<QAbstractButton *>(&buttonBox);
|
||||
QList<QAbstractButton *> children = buttonBox.findChildren<QAbstractButton *>();
|
||||
QTEST(children.count(), "totalCount");
|
||||
delete button;
|
||||
}
|
||||
|
|
@ -292,7 +292,7 @@ void tst_QDialogButtonBox::addButton2()
|
|||
QCOMPARE(buttonBox.buttons().count(), 0);
|
||||
buttonBox.addButton(text, role);
|
||||
QTEST(buttonBox.buttons().count(), "totalCount");
|
||||
QList<QAbstractButton *> children = qFindChildren<QAbstractButton *>(&buttonBox);
|
||||
QList<QAbstractButton *> children = buttonBox.findChildren<QAbstractButton *>();
|
||||
QTEST(children.count(), "totalCount");
|
||||
}
|
||||
|
||||
|
|
@ -319,7 +319,7 @@ void tst_QDialogButtonBox::addButton3()
|
|||
QCOMPARE(buttonBox.buttons().count(), 0);
|
||||
buttonBox.addButton(button);
|
||||
QTEST(buttonBox.buttons().count(), "totalCount");
|
||||
QList<QAbstractButton *> children = qFindChildren<QAbstractButton *>(&buttonBox);
|
||||
QList<QAbstractButton *> children = buttonBox.findChildren<QAbstractButton *>();
|
||||
QTEST(children.count(), "totalCount");
|
||||
}
|
||||
|
||||
|
|
@ -341,7 +341,7 @@ void tst_QDialogButtonBox::clear()
|
|||
buttonBox.addButton("Happy", QDialogButtonBox::ButtonRole(i));
|
||||
buttonBox.clear();
|
||||
QCOMPARE(buttonBox.buttons().count(), 0);
|
||||
QList<QAbstractButton *> children = qFindChildren<QAbstractButton *>(&buttonBox);
|
||||
QList<QAbstractButton *> children = buttonBox.findChildren<QAbstractButton *>();
|
||||
QCOMPARE(children.count(), 0);
|
||||
}
|
||||
|
||||
|
|
@ -376,11 +376,11 @@ void tst_QDialogButtonBox::testDelete()
|
|||
QPushButton *deleteMe = new QPushButton("Happy");
|
||||
buttonBox.addButton(deleteMe, QDialogButtonBox::HelpRole);
|
||||
QCOMPARE(buttonBox.buttons().count(), 1);
|
||||
QList<QAbstractButton *> children = qFindChildren<QAbstractButton *>(&buttonBox);
|
||||
QList<QAbstractButton *> children = buttonBox.findChildren<QAbstractButton *>();
|
||||
QCOMPARE(children.count(), 1);
|
||||
|
||||
delete deleteMe;
|
||||
children = qFindChildren<QAbstractButton *>(&buttonBox);
|
||||
children = buttonBox.findChildren<QAbstractButton *>();
|
||||
QCOMPARE(children.count(), 0);
|
||||
QCOMPARE(buttonBox.buttons().count(), 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -731,7 +731,7 @@ void tst_QMainWindow::statusBar()
|
|||
// deleting the status bar should remove it from the main window
|
||||
QMainWindow mw;
|
||||
QStatusBar *sb = mw.statusBar();
|
||||
QMainWindowLayout *l = qFindChild<QMainWindowLayout *>(&mw);
|
||||
QMainWindowLayout *l = mw.findChild<QMainWindowLayout *>();
|
||||
QVERIFY(l);
|
||||
int indexOfSb = l->indexOf(sb);
|
||||
QVERIFY(indexOfSb != -1);
|
||||
|
|
@ -1425,7 +1425,7 @@ void AddDockWidget::apply(QMainWindow *mw) const
|
|||
|
||||
QDockWidget *other = 0;
|
||||
if (mode == SplitMode || mode == TabMode) {
|
||||
other = qFindChild<QDockWidget*>(mw, this->other);
|
||||
other = mw->findChild<QDockWidget*>(this->other);
|
||||
QVERIFY(other != 0);
|
||||
}
|
||||
|
||||
|
|
@ -1463,14 +1463,14 @@ Q_DECLARE_METATYPE(MoveList)
|
|||
|
||||
void MoveSeparator::apply(QMainWindow *mw) const
|
||||
{
|
||||
QMainWindowLayout *l = qFindChild<QMainWindowLayout *>(mw);
|
||||
QMainWindowLayout *l = mw->findChild<QMainWindowLayout *>();
|
||||
QVERIFY(l);
|
||||
|
||||
QList<int> path;
|
||||
if (name.isEmpty()) {
|
||||
path << area;
|
||||
} else {
|
||||
QDockWidget *dw = qFindChild<QDockWidget*>(mw, name);
|
||||
QDockWidget *dw = mw->findChild<QDockWidget*>(name);
|
||||
QVERIFY(dw != 0);
|
||||
path = l->layoutState.dockAreaLayout.indexOf(dw);
|
||||
}
|
||||
|
|
@ -1488,7 +1488,7 @@ void MoveSeparator::apply(QMainWindow *mw) const
|
|||
QMap<QString, QRect> dockWidgetGeometries(QMainWindow *mw)
|
||||
{
|
||||
QMap<QString, QRect> result;
|
||||
QList<QDockWidget*> dockWidgets = qFindChildren<QDockWidget*>(mw);
|
||||
QList<QDockWidget*> dockWidgets = mw->findChildren<QDockWidget*>();
|
||||
foreach (QDockWidget *dw, dockWidgets)
|
||||
result.insert(dw->objectName(), dw->geometry());
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ static bool tabBetweenSubWindowsIn(QMdiArea *mdiArea, int tabCount = -1, bool re
|
|||
if (tabCount > 1)
|
||||
QTest::qWait(500);
|
||||
if (walkThrough) {
|
||||
QRubberBand *rubberBand = qFindChild<QRubberBand *>(mdiArea->viewport());
|
||||
QRubberBand *rubberBand = mdiArea->viewport()->findChild<QRubberBand *>();
|
||||
if (!rubberBand) {
|
||||
qWarning("No rubber band");
|
||||
return false;
|
||||
|
|
@ -2334,14 +2334,14 @@ void tst_QMdiArea::setViewMode()
|
|||
|
||||
// Default.
|
||||
QVERIFY(!activeSubWindow->isMaximized());
|
||||
QTabBar *tabBar = qFindChild<QTabBar *>(&mdiArea);
|
||||
QTabBar *tabBar = mdiArea.findChild<QTabBar *>();
|
||||
QVERIFY(!tabBar);
|
||||
QCOMPARE(mdiArea.viewMode(), QMdiArea::SubWindowView);
|
||||
|
||||
// Tabbed view.
|
||||
mdiArea.setViewMode(QMdiArea::TabbedView);
|
||||
QCOMPARE(mdiArea.viewMode(), QMdiArea::TabbedView);
|
||||
tabBar = qFindChild<QTabBar *>(&mdiArea);
|
||||
tabBar = mdiArea.findChild<QTabBar *>();
|
||||
QVERIFY(tabBar);
|
||||
QVERIFY(tabBar->isVisible());
|
||||
|
||||
|
|
@ -2408,7 +2408,7 @@ void tst_QMdiArea::setViewMode()
|
|||
// Go back to default (QMdiArea::SubWindowView).
|
||||
mdiArea.setViewMode(QMdiArea::SubWindowView);
|
||||
QVERIFY(!activeSubWindow->isMaximized());
|
||||
tabBar = qFindChild<QTabBar *>(&mdiArea);
|
||||
tabBar = mdiArea.findChild<QTabBar *>();
|
||||
QVERIFY(!tabBar);
|
||||
QCOMPARE(mdiArea.viewMode(), QMdiArea::SubWindowView);
|
||||
}
|
||||
|
|
@ -2422,14 +2422,14 @@ void tst_QMdiArea::setTabsClosable()
|
|||
QCOMPARE(mdiArea.tabsClosable(), false);
|
||||
|
||||
// change value before tab bar exists
|
||||
QTabBar *tabBar = qFindChild<QTabBar *>(&mdiArea);
|
||||
QTabBar *tabBar = mdiArea.findChild<QTabBar *>();
|
||||
QVERIFY(!tabBar);
|
||||
mdiArea.setTabsClosable(true);
|
||||
QCOMPARE(mdiArea.tabsClosable(), true);
|
||||
|
||||
// force tab bar creation
|
||||
mdiArea.setViewMode(QMdiArea::TabbedView);
|
||||
tabBar = qFindChild<QTabBar *>(&mdiArea);
|
||||
tabBar = mdiArea.findChild<QTabBar *>();
|
||||
QVERIFY(tabBar);
|
||||
|
||||
// value must've been propagated
|
||||
|
|
@ -2452,14 +2452,14 @@ void tst_QMdiArea::setTabsMovable()
|
|||
QCOMPARE(mdiArea.tabsMovable(), false);
|
||||
|
||||
// change value before tab bar exists
|
||||
QTabBar *tabBar = qFindChild<QTabBar *>(&mdiArea);
|
||||
QTabBar *tabBar = mdiArea.findChild<QTabBar *>();
|
||||
QVERIFY(!tabBar);
|
||||
mdiArea.setTabsMovable(true);
|
||||
QCOMPARE(mdiArea.tabsMovable(), true);
|
||||
|
||||
// force tab bar creation
|
||||
mdiArea.setViewMode(QMdiArea::TabbedView);
|
||||
tabBar = qFindChild<QTabBar *>(&mdiArea);
|
||||
tabBar = mdiArea.findChild<QTabBar *>();
|
||||
QVERIFY(tabBar);
|
||||
|
||||
// value must've been propagated
|
||||
|
|
@ -2500,7 +2500,7 @@ void tst_QMdiArea::setTabShape()
|
|||
|
||||
mdiArea.setViewMode(QMdiArea::TabbedView);
|
||||
|
||||
QTabBar *tabBar = qFindChild<QTabBar *>(&mdiArea);
|
||||
QTabBar *tabBar = mdiArea.findChild<QTabBar *>();
|
||||
QVERIFY(tabBar);
|
||||
QCOMPARE(tabBar->shape(), QTabBar::TriangularNorth);
|
||||
|
||||
|
|
@ -2543,7 +2543,7 @@ void tst_QMdiArea::setTabPosition()
|
|||
// Default.
|
||||
QCOMPARE(mdiArea.tabPosition(), QTabWidget::North);
|
||||
mdiArea.setViewMode(QMdiArea::TabbedView);
|
||||
QTabBar *tabBar = qFindChild<QTabBar *>(&mdiArea);
|
||||
QTabBar *tabBar = mdiArea.findChild<QTabBar *>();
|
||||
QVERIFY(tabBar);
|
||||
QCOMPARE(tabBar->shape(), QTabBar::RoundedNorth);
|
||||
|
||||
|
|
|
|||
|
|
@ -598,7 +598,7 @@ void tst_QMdiSubWindow::showShaded()
|
|||
QWidget *mouseReceiver = 0;
|
||||
#ifdef Q_OS_MAC
|
||||
if (window->style()->inherits("QMacStyle"))
|
||||
mouseReceiver = qFindChild<QSizeGrip *>(window);
|
||||
mouseReceiver = window->findChild<QSizeGrip *>();
|
||||
else
|
||||
#endif
|
||||
mouseReceiver = window;
|
||||
|
|
@ -707,7 +707,7 @@ void tst_QMdiSubWindow::setOpaqueResizeAndMove()
|
|||
|
||||
QWidget *mouseReceiver = 0;
|
||||
if (window->style()->inherits("QMacStyle"))
|
||||
mouseReceiver = qFindChild<QSizeGrip *>(window);
|
||||
mouseReceiver = window->findChild<QSizeGrip *>();
|
||||
else
|
||||
mouseReceiver = window;
|
||||
QVERIFY(mouseReceiver);
|
||||
|
|
@ -1447,12 +1447,12 @@ void tst_QMdiSubWindow::defaultSizeGrip()
|
|||
// QSizeGrip on windows with decoration.
|
||||
QMdiSubWindow *windowWithDecoration = mdiArea.addSubWindow(new QWidget);
|
||||
windowWithDecoration->show();
|
||||
QVERIFY(qFindChild<QSizeGrip *>(windowWithDecoration));
|
||||
QVERIFY(windowWithDecoration->findChild<QSizeGrip *>());
|
||||
|
||||
// ...but not on windows without decoration (Qt::FramelessWindowHint).
|
||||
QMdiSubWindow *windowWithoutDecoration = mdiArea.addSubWindow(new QWidget, Qt::FramelessWindowHint);
|
||||
windowWithoutDecoration->show();
|
||||
QVERIFY(!qFindChild<QSizeGrip *>(windowWithoutDecoration));
|
||||
QVERIFY(!windowWithoutDecoration->findChild<QSizeGrip *>());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1119,7 +1119,7 @@ void tst_QPlainTextEdit::mimeDataReimplementations()
|
|||
QCOMPARE(ed.insertCallCount, 0);
|
||||
|
||||
#ifdef QT_BUILD_INTERNAL
|
||||
QWidgetTextControl *control = qFindChild<QWidgetTextControl *>(&ed);
|
||||
QWidgetTextControl *control = ed.findChild<QWidgetTextControl *>();
|
||||
QVERIFY(control);
|
||||
|
||||
control->canInsertFromMimeData(QApplication::clipboard()->mimeData());
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ void tst_QStatusBar::setSizeGripEnabled()
|
|||
QVERIFY(QTest::qWaitForWindowExposed(&mainWindow));
|
||||
|
||||
QTRY_VERIFY(statusBar->isVisible());
|
||||
QPointer<QSizeGrip> sizeGrip = qFindChild<QSizeGrip *>(statusBar);
|
||||
QPointer<QSizeGrip> sizeGrip = statusBar->findChild<QSizeGrip *>();
|
||||
QVERIFY(sizeGrip);
|
||||
QVERIFY(sizeGrip->isVisible());
|
||||
|
||||
|
|
@ -211,7 +211,7 @@ void tst_QStatusBar::setSizeGripEnabled()
|
|||
statusBar = mainWindow.statusBar();
|
||||
QVERIFY(statusBar);
|
||||
|
||||
sizeGrip = qFindChild<QSizeGrip *>(statusBar);
|
||||
sizeGrip = statusBar->findChild<QSizeGrip *>();
|
||||
QVERIFY(sizeGrip);
|
||||
QVERIFY(!sizeGrip->isVisible());
|
||||
|
||||
|
|
|
|||
|
|
@ -1483,7 +1483,7 @@ void tst_QTextEdit::mimeDataReimplementations()
|
|||
QCOMPARE(ed.insertCallCount, 0);
|
||||
|
||||
#ifdef QT_BUILD_INTERNAL
|
||||
QWidgetTextControl *control = qFindChild<QWidgetTextControl *>(&ed);
|
||||
QWidgetTextControl *control = ed.findChild<QWidgetTextControl *>();
|
||||
QVERIFY(control);
|
||||
|
||||
control->canInsertFromMimeData(QApplication::clipboard()->mimeData());
|
||||
|
|
@ -2104,7 +2104,7 @@ void tst_QTextEdit::cursorRect()
|
|||
#ifdef QT_BUILD_INTERNAL
|
||||
void tst_QTextEdit::setDocumentPreservesPalette()
|
||||
{
|
||||
QWidgetTextControl *control = qFindChild<QWidgetTextControl *>(ed);
|
||||
QWidgetTextControl *control = ed->findChild<QWidgetTextControl *>();
|
||||
QVERIFY(control);
|
||||
|
||||
QPalette defaultPal = ed->palette();
|
||||
|
|
|
|||
Loading…
Reference in New Issue