mirror of
https://github.com/chylex/Nextcloud-Desktop.git
synced 2025-05-10 08:34:08 +02:00
More Button: Use SVG and fix size so it renders good in highdpi
When the more button was changed from using a text to an icon, the size computation was not adjusted proerly to that of a button with an icon. And using svg allows it to be rendered correctly with high-dpi It looks much much nicer now
This commit is contained in:
parent
ad43d88fde
commit
c4af4a5a85
@ -20,7 +20,7 @@
|
||||
<file>resources/lock-https.png</file>
|
||||
<file>resources/lock-https@2x.png</file>
|
||||
<file>resources/account.png</file>
|
||||
<file>resources/more.png</file>
|
||||
<file>resources/more.svg</file>
|
||||
<file>resources/delete.png</file>
|
||||
<file>resources/bell.png</file>
|
||||
</qresource>
|
||||
|
Binary file not shown.
Before ![]() (image error) Size: 122 B |
5
resources/more.svg
Normal file
5
resources/more.svg
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="16" width="16" version="1.0" xmlns:cc="http://creativecommons.org/ns#" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||
<rect style="color:#000000" fill-opacity="0" height="97.986" width="163.31" y="-32.993" x="-62.897"/>
|
||||
<path d="m3 6c-1.1046 0-2 0.8954-2 2s0.8954 2 2 2 2-0.8954 2-2-0.8954-2-2-2zm5 0c-1.1046 0-2 0.8954-2 2s0.8954 2 2 2 2-0.8954 2-2-0.8954-2-2-2zm5 0c-1.105 0-2 0.8954-2 2s0.895 2 2 2 2-0.8954 2-2-0.895-2-2-2z" fill-rule="evenodd"/>
|
||||
</svg>
|
After (image error) Size: 660 B |
@ -38,7 +38,7 @@ namespace OCC {
|
||||
FolderStatusDelegate::FolderStatusDelegate()
|
||||
: QStyledItemDelegate()
|
||||
{
|
||||
m_moreIcon = QIcon(QLatin1String(":/client/resources/more.png"));
|
||||
m_moreIcon = QIcon(QLatin1String(":/client/resources/more.svg"));
|
||||
}
|
||||
|
||||
QString FolderStatusDelegate::addFolderText()
|
||||
@ -336,7 +336,6 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
|
||||
|
||||
{
|
||||
QStyleOptionToolButton btnOpt;
|
||||
//btnOpt.text = QLatin1String("...");
|
||||
btnOpt.state = option.state;
|
||||
btnOpt.state &= ~(QStyle::State_Selected | QStyle::State_HasFocus);
|
||||
btnOpt.state |= QStyle::State_Raised;
|
||||
@ -344,7 +343,8 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
|
||||
btnOpt.subControls = QStyle::SC_ToolButton;
|
||||
btnOpt.rect = optionsButtonVisualRect;
|
||||
btnOpt.icon = m_moreIcon;
|
||||
btnOpt.iconSize = btnOpt.rect.size();
|
||||
int e = QApplication::style()->pixelMetric(QStyle::PM_ButtonIconSize);
|
||||
btnOpt.iconSize = QSize(e,e);
|
||||
QApplication::style()->drawComplexControl(QStyle::CC_ToolButton, &btnOpt, painter);
|
||||
}
|
||||
}
|
||||
@ -364,10 +364,9 @@ QRect FolderStatusDelegate::optionsButtonRect(QRect within, Qt::LayoutDirection
|
||||
within.setHeight(FolderStatusDelegate::rootFolderHeightWithoutErrors(fm, aliasFm));
|
||||
|
||||
QStyleOptionToolButton opt;
|
||||
opt.text = QLatin1String("...");
|
||||
QSize textSize = fm.size(Qt::TextShowMnemonic, opt.text);
|
||||
opt.rect.setSize(textSize);
|
||||
QSize size = QApplication::style()->sizeFromContents(QStyle::CT_ToolButton, &opt, textSize).expandedTo(QApplication::globalStrut());
|
||||
int e = QApplication::style()->pixelMetric(QStyle::PM_ButtonIconSize);
|
||||
opt.rect.setSize(QSize(e,e));
|
||||
QSize size = QApplication::style()->sizeFromContents(QStyle::CT_ToolButton, &opt, opt.rect.size()).expandedTo(QApplication::globalStrut());
|
||||
|
||||
int margin = QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing);
|
||||
QRect r(QPoint(within.right() - size.width() - margin,
|
||||
|
@ -381,7 +381,7 @@ ShareUserLine::ShareUserLine(QSharedPointer<Share> share,
|
||||
_ui->permissionToolButton->setMenu(menu);
|
||||
_ui->permissionToolButton->setPopupMode(QToolButton::InstantPopup);
|
||||
|
||||
QIcon icon(QLatin1String(":/client/resources/more.png"));
|
||||
QIcon icon(QLatin1String(":/client/resources/more.svg"));
|
||||
_ui->permissionToolButton->setIcon(icon);
|
||||
|
||||
// If there's only a single entry in the detailed permission menu, hide it
|
||||
|
Loading…
Reference in New Issue
Block a user