Utils: Let FancyLineEdit have QIcons instead of QPixmaps

A QIcon contains variants for different resolutions. This change
makes sure that in a Multi-screen/mixed-scaling-mode scenario,
the right of those resolutions is chosen, depending on which screen
the line edit currently is.

Task-number: QTCREATORBUG-18869
Change-Id: I8775e9e2c9b15c2863e9415751e1306f9e43c9aa
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Alessandro Portale
2017-09-05 12:59:31 +02:00
parent f4ff420036
commit 6b0b8c24b5
5 changed files with 24 additions and 30 deletions

View File

@@ -107,7 +107,7 @@ public:
void createIconButton()
{
m_iconButton = new IconButton;
m_iconButton->setPixmap(Utils::Icons::REPLACE.pixmap());
m_iconButton->setIcon(Utils::Icons::REPLACE.icon());
m_iconButton->setToolTip(VariableChooser::tr("Insert Variable"));
m_iconButton->hide();
connect(m_iconButton.data(), static_cast<void(QAbstractButton::*)(bool)>(&QAbstractButton::clicked),
@@ -457,11 +457,7 @@ void VariableChooserPrivate::updateDescription(const QModelIndex &index)
*/
int VariableChooserPrivate::buttonMargin() const
{
int margin = m_iconButton->pixmap().width() + 8;
if (q->style()->inherits("OxygenStyle"))
margin = qMax(24, margin);
return margin;
return 24;
}
void VariableChooserPrivate::updateButtonGeometry()