Uniform window icon & optimize code.
This commit is contained in:
parent
b47720396e
commit
f4ea89dec8
|
@ -19,7 +19,6 @@
|
|||
*
|
||||
*/
|
||||
#include <QtConcurrent>
|
||||
#include <QApplication>
|
||||
#include <QPalette>
|
||||
#include "global-settings.h"
|
||||
|
||||
|
@ -83,6 +82,8 @@ GlobalSettings::GlobalSettings(QObject *parent) : QObject(parent) {
|
|||
qApp->paletteChanged(qApp->palette());
|
||||
m_cache.remove(FONT_SIZE_KEY);
|
||||
m_cache.insert(FONT_SIZE_KEY, m_theme_gsettings->get(FONT_SIZE_KEY).toDouble());
|
||||
} else if (key == ICON_THEME_KEY) {
|
||||
qApp->paletteChanged(qApp->palette());
|
||||
}
|
||||
});
|
||||
m_cache.remove(STYLE_NAME_KEY);
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <QGSettings/QGSettings>
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusInterface>
|
||||
#include <QApplication>
|
||||
#include "libsearch_global.h"
|
||||
|
||||
#define CONTROL_CENTER_PERSONALISE_GSETTINGS_ID "org.ukui.control-center.personalise"
|
||||
|
@ -40,6 +41,7 @@
|
|||
#define THEME_GSETTINGS_ID "org.ukui.style"
|
||||
#define STYLE_NAME_KEY "styleName"
|
||||
#define FONT_SIZE_KEY "systemFontSize"
|
||||
#define ICON_THEME_KEY "iconThemeName"
|
||||
#define INDEX_DATABASE_STATE "index_database_state"
|
||||
#define CONTENT_INDEX_DATABASE_STATE "content_index_database_state"
|
||||
#define INDEX_GENERATOR_NORMAL_EXIT "index_generator_normal_exit"
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include <QDebug>
|
||||
#include <QLabel>
|
||||
#include <QTimer>
|
||||
#include <QApplication>
|
||||
#include "config-file.h"
|
||||
|
||||
using namespace Zeeker;
|
||||
|
|
|
@ -20,12 +20,10 @@
|
|||
*/
|
||||
#include "highlight-item-delegate.h"
|
||||
#include <QPainter>
|
||||
#include <QApplication>
|
||||
#include <QStyle>
|
||||
#include <QDebug>
|
||||
#include <QTextDocument>
|
||||
#include <QAbstractTextDocumentLayout>
|
||||
#include "global-settings.h"
|
||||
|
||||
using namespace Zeeker;
|
||||
HighlightItemDelegate::HighlightItemDelegate(QObject *parent) : QStyledItemDelegate(parent) {
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#define HIGHLIGHTITEMDELEGATE_H
|
||||
|
||||
#include <QStyledItemDelegate>
|
||||
#include "global-settings.h"
|
||||
|
||||
namespace Zeeker {
|
||||
class HighlightItemDelegate : public QStyledItemDelegate {
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <QPainter>
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
#include <QApplication>
|
||||
|
||||
using namespace Zeeker;
|
||||
HomePageItem::HomePageItem(QWidget *parent, const int& type, const QString& path) : QWidget(parent) {
|
||||
|
|
|
@ -20,11 +20,10 @@
|
|||
*/
|
||||
|
||||
#include "create-index-ask-dialog.h"
|
||||
#include <QPainter>
|
||||
|
||||
using namespace Zeeker;
|
||||
CreateIndexAskDialog::CreateIndexAskDialog(QWidget *parent) : QDialog(parent) {
|
||||
this->setWindowIcon(QIcon::fromTheme("kylin-search"));
|
||||
// this->setWindowIcon(QIcon::fromTheme("kylin-search"));
|
||||
this->setWindowTitle(tr("ukui-search"));
|
||||
|
||||
initUi();
|
||||
|
@ -46,6 +45,10 @@ void CreateIndexAskDialog::initUi() {
|
|||
m_iconLabel = new QLabel(m_titleFrame);
|
||||
m_iconLabel->setFixedSize(24, 24);
|
||||
m_iconLabel->setPixmap(QIcon::fromTheme("kylin-search").pixmap(QSize(24, 24)));
|
||||
//主题改变时,更新自定义标题栏的图标
|
||||
connect(qApp, &QApplication::paletteChanged, this, [ = ]() {
|
||||
m_iconLabel->setPixmap(QIcon::fromTheme("kylin-search").pixmap(QSize(24, 24)));
|
||||
});
|
||||
m_titleLabel = new QLabel(m_titleFrame);
|
||||
m_titleLabel->setText(tr("Search"));
|
||||
m_closeBtn = new QPushButton(m_titleFrame);
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QStyleOption>
|
||||
#include <QApplication>
|
||||
#include <QPainter>
|
||||
|
||||
namespace Zeeker {
|
||||
class CreateIndexAskDialog : public QDialog {
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <syslog.h>
|
||||
#include <ukui-log4qt.h>
|
||||
#include <QObject>
|
||||
#include <QApplication>
|
||||
#include "qt-single-application.h"
|
||||
#include "qt-local-peer.h"
|
||||
//#include "inotify-manager.h"
|
||||
|
@ -268,6 +269,7 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
//set main window to the center of screen
|
||||
MainWindow *w = new MainWindow;
|
||||
qApp->setWindowIcon(QIcon::fromTheme("kylin-search"));
|
||||
// centerToScreen(w);
|
||||
// w->moveToPanel();
|
||||
centerToScreen(w);
|
||||
|
|
|
@ -58,7 +58,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
|
||||
// this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);
|
||||
// this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
|
||||
this->setWindowIcon(QIcon::fromTheme("kylin-search"));
|
||||
// this->setWindowIcon(QIcon::fromTheme("kylin-search"));
|
||||
this->setAttribute(Qt::WA_TranslucentBackground, true);
|
||||
this->setAutoFillBackground(false);
|
||||
this->setFocusPolicy(Qt::StrongFocus);
|
||||
|
@ -189,6 +189,10 @@ void MainWindow::initUi() {
|
|||
m_iconLabel = new QLabel(m_titleFrame);
|
||||
m_iconLabel->setFixedSize(24, 24);
|
||||
m_iconLabel->setPixmap(QIcon::fromTheme("kylin-search").pixmap(QSize(24, 24)));
|
||||
//主题改变时,更新自定义标题栏的图标
|
||||
connect(qApp, &QApplication::paletteChanged, this, [ = ]() {
|
||||
m_iconLabel->setPixmap(QIcon::fromTheme("kylin-search").pixmap(QSize(24, 24)));
|
||||
});
|
||||
m_titleLabel = new QLabel(m_titleFrame);
|
||||
m_titleLabel->setText(tr("Search"));
|
||||
m_menuBtn = new QPushButton(m_titleFrame);
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
using namespace Zeeker;
|
||||
extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed);
|
||||
SettingsWidget::SettingsWidget(QWidget *parent) : QWidget(parent) {
|
||||
this->setWindowIcon(QIcon::fromTheme("kylin-search"));
|
||||
// this->setWindowIcon(QIcon::fromTheme("kylin-search"));
|
||||
this->setWindowTitle(tr("ukui-search-settings"));
|
||||
// this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
|
||||
// this->setAttribute(Qt::WA_TranslucentBackground);
|
||||
|
@ -70,6 +70,10 @@ void SettingsWidget::initUi() {
|
|||
m_titleFrame->setLayout(m_titleLyt);
|
||||
m_titleIcon = new QLabel(m_titleFrame);
|
||||
m_titleIcon->setPixmap(QIcon::fromTheme("kylin-search").pixmap(QSize(24, 24)));
|
||||
//主题改变时,更新自定义标题栏的图标
|
||||
connect(qApp, &QApplication::paletteChanged, this, [ = ]() {
|
||||
m_titleIcon->setPixmap(QIcon::fromTheme("kylin-search").pixmap(QSize(24, 24)));
|
||||
});
|
||||
m_titleLabel = new QLabel(m_titleFrame);
|
||||
m_titleLabel->setText(tr("Search"));
|
||||
m_closeBtn = new QPushButton(m_titleFrame);
|
||||
|
|
Loading…
Reference in New Issue