mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 10:52:56 +00:00
show preview even of the desktop style
the desktop style is now determined by QT_PLATFORM_PLUGIN and DESKTOP_SESSION environment variables with fallback to cleanlooks style so even if it is the fallback style there is something to show but if it is not the fallback the user will be able to preview the style chosen by QGuiPlatformPlugin Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
07d438624a
commit
abb9e71280
2 changed files with 16 additions and 14 deletions
|
@ -73,7 +73,7 @@ class Q_GUI_EXPORT QGuiPlatformPlugin : public QObject
|
||||||
};
|
};
|
||||||
|
|
||||||
// internal
|
// internal
|
||||||
QGuiPlatformPlugin *qt_guiPlatformPlugin();
|
Q_GUI_EXPORT QGuiPlatformPlugin *qt_guiPlatformPlugin();
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
|
#include <QGuiPlatformPlugin>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
@ -477,25 +478,26 @@ void MainWindow::paletteSelected(int)
|
||||||
|
|
||||||
void MainWindow::updateStyleLayout()
|
void MainWindow::updateStyleLayout()
|
||||||
{
|
{
|
||||||
QString currentStyle = ui->guiStyleCombo->currentText();
|
ui->previewFrame->setPreviewVisible(true);
|
||||||
bool autoStyle = (currentStyle == desktopThemeName);
|
ui->buildPaletteGroup->setEnabled(true);
|
||||||
ui->previewFrame->setPreviewVisible(!autoStyle);
|
|
||||||
ui->buildPaletteGroup->setEnabled(!autoStyle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::styleSelected(const QString &stylename)
|
void MainWindow::styleSelected(const QString &stylename)
|
||||||
{
|
{
|
||||||
|
QString realstyle(stylename);
|
||||||
if (stylename == desktopThemeName) {
|
if (stylename == desktopThemeName) {
|
||||||
setModified(true);
|
QGuiPlatformPlugin* platformplugin = qt_guiPlatformPlugin();
|
||||||
} else {
|
if (platformplugin) {
|
||||||
QStyle *style = QStyleFactory::create(stylename);
|
realstyle = platformplugin->styleName();
|
||||||
if (!style)
|
}
|
||||||
return;
|
|
||||||
setStyleHelper(ui->previewFrame, style);
|
|
||||||
delete previewstyle;
|
|
||||||
previewstyle = style;
|
|
||||||
setModified(true);
|
|
||||||
}
|
}
|
||||||
|
QStyle *style = QStyleFactory::create(realstyle);
|
||||||
|
if (!style)
|
||||||
|
return;
|
||||||
|
setStyleHelper(ui->previewFrame, style);
|
||||||
|
delete previewstyle;
|
||||||
|
previewstyle = style;
|
||||||
|
setModified(true);
|
||||||
updateStyleLayout();
|
updateStyleLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue