Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Education
LabPlot
Commits
3f01893f
Commit
3f01893f
authored
Jul 03, 2020
by
Alexander Semke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better calculation of the fixed side of ThemesWidget.
parent
10590878
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
src/kdefrontend/widgets/ThemesWidget.cpp
src/kdefrontend/widgets/ThemesWidget.cpp
+6
-5
No files found.
src/kdefrontend/widgets/ThemesWidget.cpp
View file @
3f01893f
...
@@ -41,7 +41,7 @@
...
@@ -41,7 +41,7 @@
#include <KMessageBox>
#include <KMessageBox>
// #include <knewstuff3/downloaddialog.h>
// #include <knewstuff3/downloaddialog.h>
#include <cmath>
/*!
/*!
\class ThemesWidget
\class ThemesWidget
...
@@ -57,7 +57,7 @@ ThemesWidget::ThemesWidget(QWidget* parent) : QListView(parent) {
...
@@ -57,7 +57,7 @@ ThemesWidget::ThemesWidget(QWidget* parent) : QListView(parent) {
setDragDropMode
(
QListView
::
NoDragDrop
);
setDragDropMode
(
QListView
::
NoDragDrop
);
//make the icon 3x3cm big and show two of them in the height
//make the icon 3x3cm big and show two of them in the height
static
const
int
themeIconSize
=
3.0
/
2.54
*
QApplication
::
desktop
()
->
physicalDpiX
();
static
const
int
themeIconSize
=
std
::
ceil
(
3.0
/
2.54
*
QApplication
::
desktop
()
->
physicalDpiX
()
)
;
setIconSize
(
QSize
(
themeIconSize
,
themeIconSize
));
setIconSize
(
QSize
(
themeIconSize
,
themeIconSize
));
setHorizontalScrollBarPolicy
(
Qt
::
ScrollBarAlwaysOff
);
setHorizontalScrollBarPolicy
(
Qt
::
ScrollBarAlwaysOff
);
...
@@ -129,11 +129,12 @@ void ThemesWidget::applyClicked(const QModelIndex& index) {
...
@@ -129,11 +129,12 @@ void ThemesWidget::applyClicked(const QModelIndex& index) {
void
ThemesWidget
::
setFixedMode
()
{
void
ThemesWidget
::
setFixedMode
()
{
//resize the widget to show three items only
//resize the widget to show three items only
int
frameWidth
=
style
()
->
pixelMetric
(
QStyle
::
PM_DefaultFrameWidth
);
QFont
font
;
QFont
font
;
QFontMetrics
fm
(
font
);
QFontMetrics
fm
(
font
);
static
const
int
themeIconSize
=
3.0
/
2.54
*
QApplication
::
desktop
()
->
physicalDpiX
();
static
const
int
themeIconSize
=
std
::
ceil
(
3.0
/
2.54
*
QApplication
::
desktop
()
->
physicalDpiX
()
)
;
QSize
widgetSize
(
themeIconSize
+
qApp
->
style
()
->
pixelMetric
(
QStyle
::
PM_ScrollBarExtent
),
QSize
widgetSize
(
themeIconSize
+
style
()
->
pixelMetric
(
QStyle
::
PM_ScrollBarExtent
)
+
frameWidth
*
2
,
3
*
(
themeIconSize
+
fm
.
height
()
+
2
*
spacing
()
)
+
fm
.
height
()
+
spacing
()
);
3
*
(
themeIconSize
+
fm
.
height
()
+
2
*
frameWidth
)
+
fm
.
height
()
+
frameWidth
);
setMinimumSize
(
widgetSize
);
setMinimumSize
(
widgetSize
);
setMaximumSize
(
widgetSize
);
setMaximumSize
(
widgetSize
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment