MarbleLineEdit::MarbleLineEdit( QWidget *parent ) : QLineEdit( parent ), d( new MarbleLineEditPrivate( this ) ) { updateClearButtonIcon( text() ); updateClearButton(); setDecorator( d->m_decoratorPixmap ); connect( this, SIGNAL(textChanged(QString)), SLOT(updateClearButtonIcon(QString)) ); connect( &d->m_progressTimer, SIGNAL(timeout()), this, SLOT(updateProgress()) ); }
RoutingLineEdit::RoutingLineEdit( QWidget *parent ) : QLineEdit( parent ), d( new RoutingLineEditPrivate( this ) ) { updateClearButtonIcon( text() ); updateClearButton(); // Padding for clear button to avoid text underflow QString const direction = layoutDirection() == Qt::LeftToRight ? "right" : "left"; if ( !MarbleGlobal::getInstance()->profiles() & MarbleGlobal::SmallScreen ) { setStyleSheet( QString( ":enabled { padding-%1: %2; }").arg( direction).arg( 18 ) ); } connect( this, SIGNAL( textChanged( QString ) ), SLOT( updateClearButtonIcon( QString ) ) ); }
void QExLineEdit::setClearButtonShown(bool show) { if (show) { if (d->clearButton) return; d->clearButton = new QExLineEditButton(this); d->clearButton->setCursor(Qt::ArrowCursor); // d->clearButton->setToolTip("Clear text"); updateClearButtonIcon(text()); updateClearButton(); // connect(this, SIGNAL(textChanged(QString)), this, SLOT(updateClearButtonIcon(QString))); } else { // disconnect(this, SIGNAL(textChanged(QString)), this, SLOT(updateClearButtonIcon(QString))); delete d->clearButton; d->clearButton = 0; d->clickInClear = false; } }