mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 05:08:05 -06:00
Drop Qt 4 support
This commit is contained in:
@@ -11,10 +11,6 @@ resources/lineeditimages.qrc
|
||||
)
|
||||
|
||||
add_library(qbt_lineedit STATIC ${QBT_LINEEDIT_SOURCES} ${QBT_LINEEDIT_HEADERS})
|
||||
if (QT4_FOUND)
|
||||
target_link_libraries(qbt_lineedit Qt4::QtGui)
|
||||
else (QT4_FOUND)
|
||||
target_link_libraries(qbt_lineedit Qt5::Widgets)
|
||||
endif (QT4_FOUND)
|
||||
target_link_libraries(qbt_lineedit Qt5::Widgets)
|
||||
|
||||
qbt_target_sources(${QBT_LINEEDIT_RESOURCES})
|
||||
|
||||
@@ -25,24 +25,8 @@ LineEdit::LineEdit(QWidget *parent)
|
||||
QSize searchButtonHint = searchButton->sizeHint();
|
||||
|
||||
QSize clearButtonHint(0, 0);
|
||||
#ifndef QBT_USES_QT5
|
||||
QPixmap pixmap2(":/lineeditimages/clear_left.png");
|
||||
clearButton = new QToolButton(this);
|
||||
clearButton->setIcon(QIcon(pixmap2));
|
||||
clearButton->setIconSize(pixmap2.size());
|
||||
clearButton->setCursor(Qt::ArrowCursor);
|
||||
clearButton->setStyleSheet("QToolButton { border: none; padding: 2px; }");
|
||||
clearButton->setToolTip(tr("Clear the text"));
|
||||
clearButton->hide();
|
||||
connect(clearButton, SIGNAL(clicked()), this, SLOT(clear()));
|
||||
connect(this, SIGNAL(textChanged(const QString &)), this, SLOT(updateCloseButton(const QString &)));
|
||||
|
||||
clearButtonHint = clearButton->sizeHint();
|
||||
setStyleSheet(QString("QLineEdit { padding-left: %1px; padding-right: %2px; }").arg(searchButtonHint.width()).arg(clearButtonHint.width()));
|
||||
#else
|
||||
setClearButtonEnabled(true);
|
||||
setStyleSheet(QString("QLineEdit { padding-left: %1px; }").arg(searchButtonHint.width())); // padding between text and widget borders
|
||||
#endif
|
||||
|
||||
QSize widgetHint = sizeHint();
|
||||
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
||||
@@ -56,15 +40,5 @@ void LineEdit::resizeEvent(QResizeEvent *e)
|
||||
|
||||
QSize sz = searchButton->sizeHint();
|
||||
searchButton->move(frameWidth, (e->size().height() - sz.height()) / 2);
|
||||
#ifndef QBT_USES_QT5
|
||||
QSize cz = clearButton->sizeHint();
|
||||
clearButton->move((e->size().width() - frameWidth - cz.width()), (e->size().height() - sz.height()) / 2);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef QBT_USES_QT5
|
||||
void LineEdit::updateCloseButton(const QString &text)
|
||||
{
|
||||
clearButton->setVisible(!text.isEmpty());
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -24,16 +24,8 @@ public:
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
|
||||
#ifndef QBT_USES_QT5
|
||||
private slots:
|
||||
void updateCloseButton(const QString &text);
|
||||
#endif
|
||||
|
||||
private:
|
||||
QToolButton *searchButton;
|
||||
#ifndef QBT_USES_QT5
|
||||
QToolButton *clearButton;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // LIENEDIT_H
|
||||
|
||||
Reference in New Issue
Block a user