void QSearchLineEdit::updateCloseButton(const QString &text) { clearButton->setVisible(!text.isEmpty()); resetNotFound(); if (!maybeFound) { resetNotFound(); } }
void MpcImportWindow::resetDialog() { ui->stackedWidget->setCurrentIndex(0); //ui->tabWidget->setCurrentIndex(0); ui->groupBoxType->setVisible(true); ui->radioButtonAsteroids->setChecked(true); ui->radioButtonURL->setChecked(true); ui->frameFile->setVisible(false); ui->lineEditFilePath->clear(); ui->lineEditQuery->clear(); ui->lineEditURL->setText("http://"); ui->checkBoxAddBookmark->setChecked(false); ui->frameBookmarkTitle->setVisible(false); ui->comboBoxBookmarks->setCurrentIndex(0); ui->radioButtonUpdate->setChecked(true); ui->checkBoxOnlyOrbitalElements->setChecked(true); //TODO: Is this the right place? ui->pushButtonAbortQuery->setVisible(false); ui->pushButtonAbortDownload->setVisible(false); //Resetting the dialog should not reset the timer //resetCountdown(); resetNotFound(); enableInterface(true); }
void MpcImportWindow::createDialogContent() { ui->setupUi(dialog); //Signals connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate())); connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())); connect(ui->TitleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint))); connect(ui->pushButtonAcquire, SIGNAL(clicked()), this, SLOT(acquireObjectData())); connect(ui->pushButtonAbortDownload, SIGNAL(clicked()), this, SLOT(abortDownload())); connect(ui->pushButtonAdd, SIGNAL(clicked()), this, SLOT(addObjects())); connect(ui->pushButtonDiscard, SIGNAL(clicked()), this, SLOT(discardObjects())); connect(ui->pushButtonBrowse, SIGNAL(clicked()), this, SLOT(selectFile())); connect(ui->comboBoxBookmarks, SIGNAL(currentIndexChanged(QString)), this, SLOT(bookmarkSelected(QString))); connect(ui->radioButtonFile, SIGNAL(toggled(bool)), ui->frameFile, SLOT(setVisible(bool))); connect(ui->radioButtonURL, SIGNAL(toggled(bool)), ui->frameURL, SLOT(setVisible(bool))); connect(ui->radioButtonAsteroids, SIGNAL(toggled(bool)), this, SLOT(switchImportType(bool))); connect(ui->radioButtonComets, SIGNAL(toggled(bool)), this, SLOT(switchImportType(bool))); connect(ui->pushButtonMarkAll, SIGNAL(clicked()), this, SLOT(markAll())); connect(ui->pushButtonMarkNone, SIGNAL(clicked()), this, SLOT(unmarkAll())); connect(ui->pushButtonSendQuery, SIGNAL(clicked()), this, SLOT(sendQuery())); connect(ui->lineEditQuery, SIGNAL(returnPressed()), this, SLOT(sendQuery())); connect(ui->pushButtonAbortQuery, SIGNAL(clicked()), this, SLOT(abortQuery())); connect(ui->lineEditQuery, SIGNAL(textEdited(QString)), this, SLOT(resetNotFound())); //connect(ui->lineEditQuery, SIGNAL(editingFinished()), this, SLOT(sendQuery())); connect(countdownTimer, SIGNAL(timeout()), this, SLOT(updateCountdown())); QSortFilterProxyModel * filterProxyModel = new QSortFilterProxyModel(this); filterProxyModel->setSourceModel(candidateObjectsModel); filterProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); ui->listViewObjects->setModel(filterProxyModel); connect(ui->lineEditSearch, SIGNAL(textChanged(const QString&)), filterProxyModel, SLOT(setFilterFixedString(const QString&))); loadBookmarks(); updateTexts(); resetCountdown(); resetDialog(); }
QSearchLineEdit::QSearchLineEdit(QWidget* parent, const QString &clearIconFileName, const QString &optionsIconFileName, const QString &cancelIconFileName) : QLineEdit(parent) { maybeFound = true; cancelPointer = 0; cancelButtonIcon = cancelIconFileName; searchStarted = false; sPbar = 0; stopButton = 0; QSize msz = minimumSizeHint(); QPixmap optionsPixmap(optionsIconFileName.isEmpty() ? ":/images/search.png" : optionsIconFileName); optionsPixmap = optionsPixmap.scaledToHeight(fontMetrics().height() , Qt::SmoothTransformation); optionButton = new QToolButton(this); optionButton->setIcon(QIcon(optionsPixmap)); optionButton->setIconSize(optionsPixmap.size()); optionButton->setCursor(Qt::ArrowCursor); optionButton->setStyleSheet("QToolButton { border: none; padding: 0px; }"); clearButton = new QToolButton(this); QString defaultClearIcon = ":/images/clear-left.png"; if (layoutDirection() == Qt::RightToLeft) { defaultClearIcon = ":/images/clear-right.png"; } QPixmap clearPixmap(clearIconFileName.isEmpty() ? defaultClearIcon : clearIconFileName); clearPixmap = clearPixmap.scaledToHeight(fontMetrics().height() /*msz.height()*/, Qt::SmoothTransformation); clearButton->setIcon(QIcon(clearPixmap)); clearButton->setIconSize(clearPixmap.size()); clearButton->setCursor(Qt::ArrowCursor); clearButton->hide(); connect(clearButton, SIGNAL(clicked()), this, SIGNAL(clearButtonPressed())); connect(clearButton, SIGNAL(clicked()), this, SLOT(clear())); connect(clearButton, SIGNAL(clicked()), this, SLOT(resetNotFound())); connect(this, SIGNAL(textChanged(QString)), this, SLOT(updateCloseButton(QString))); setMinimumSize(qMax(msz.width(), optionButton->sizeHint().width() + clearButton->sizeHint().width()), qMax(qMax(msz.height(), optionButton->sizeHint().height()), clearButton->sizeHint().height())); setStyleSheet(QString("QLineEdit { padding-left: %1px; padding-right: %2px; } ").arg(clearButton->sizeHint().width()).arg(optionButton->sizeHint().width())); clearButton->setStyleSheet("QToolButton { border: none; padding: 0px; }"); }