mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
generic: replace QLabel with the new KPixmapWidget class
or how to optimize painting of pixmaps and icons Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
23479d802a
commit
66f6104da4
15 changed files with 93 additions and 92 deletions
|
@ -289,11 +289,11 @@ KateVSStatusBar::KateVSStatusBar ( KateViewSpace *parent)
|
||||||
addWidget( m_charsLabel, 0 );
|
addWidget( m_charsLabel, 0 );
|
||||||
m_charsLabel->installEventFilter( this );
|
m_charsLabel->installEventFilter( this );
|
||||||
|
|
||||||
m_modifiedLabel = new QLabel( this );
|
m_modifiedWidget = new KPixmapWidget( this );
|
||||||
m_modifiedLabel->setFixedSize( 16, 16 );
|
m_modifiedWidget->setFixedSize( 16, 16 );
|
||||||
addWidget( m_modifiedLabel, 0 );
|
addWidget( m_modifiedWidget, 0 );
|
||||||
m_modifiedLabel->setAlignment( Qt::AlignCenter );
|
m_modifiedWidget->setAlignment( Qt::AlignCenter );
|
||||||
m_modifiedLabel->installEventFilter( this );
|
m_modifiedWidget->installEventFilter( this );
|
||||||
|
|
||||||
m_selectModeLabel = new QLabel( i18n(" LINE "), this );
|
m_selectModeLabel = new QLabel( i18n(" LINE "), this );
|
||||||
addWidget( m_selectModeLabel, 0 );
|
addWidget( m_selectModeLabel, 0 );
|
||||||
|
@ -430,7 +430,7 @@ void KateVSStatusBar::modifiedChanged()
|
||||||
|
|
||||||
bool modOnHD = info && info->modifiedOnDisc;
|
bool modOnHD = info && info->modifiedOnDisc;
|
||||||
|
|
||||||
m_modifiedLabel->setPixmap(
|
m_modifiedWidget->setPixmap(
|
||||||
mod ?
|
mod ?
|
||||||
info && modOnHD ?
|
info && modOnHD ?
|
||||||
m_modmodPm :
|
m_modmodPm :
|
||||||
|
|
|
@ -32,14 +32,15 @@
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
|
#include <QStackedWidget>
|
||||||
#include <KStatusBar>
|
#include <KStatusBar>
|
||||||
#include <KVBox>
|
#include <KVBox>
|
||||||
|
#include <KPixmapWidget>
|
||||||
|
|
||||||
class KConfigBase;
|
class KConfigBase;
|
||||||
class KSqueezedTextLabel;
|
class KSqueezedTextLabel;
|
||||||
class KateViewManager;
|
class KateViewManager;
|
||||||
class KateViewSpace;
|
class KateViewSpace;
|
||||||
#include <QStackedWidget>
|
|
||||||
|
|
||||||
class KateVSStatusBar : public KStatusBar
|
class KateVSStatusBar : public KStatusBar
|
||||||
{
|
{
|
||||||
|
@ -83,7 +84,7 @@ class KateVSStatusBar : public KStatusBar
|
||||||
private:
|
private:
|
||||||
QLabel* m_lineColLabel;
|
QLabel* m_lineColLabel;
|
||||||
QLabel* m_charsLabel;
|
QLabel* m_charsLabel;
|
||||||
QLabel* m_modifiedLabel;
|
KPixmapWidget* m_modifiedWidget;
|
||||||
QLabel* m_insertModeLabel;
|
QLabel* m_insertModeLabel;
|
||||||
QLabel* m_selectModeLabel;
|
QLabel* m_selectModeLabel;
|
||||||
QLabel* m_encodingLabel;
|
QLabel* m_encodingLabel;
|
||||||
|
|
|
@ -20,10 +20,11 @@
|
||||||
#include <KGlobal>
|
#include <KGlobal>
|
||||||
#include <KLocale>
|
#include <KLocale>
|
||||||
#include <KUrl>
|
#include <KUrl>
|
||||||
#include <netwm.h>
|
|
||||||
#include <KShortcut>
|
#include <KShortcut>
|
||||||
#include <kwindowsystem.h>
|
#include <KWindowSystem>
|
||||||
|
#include <KPixmapWidget>
|
||||||
#include <kkeyserver.h>
|
#include <kkeyserver.h>
|
||||||
|
#include <netwm.h>
|
||||||
|
|
||||||
#include <X11/XKBlib.h>
|
#include <X11/XKBlib.h>
|
||||||
#define XK_MISCELLANY
|
#define XK_MISCELLANY
|
||||||
|
@ -595,13 +596,13 @@ void KAccessApp::createDialogContents() {
|
||||||
QHBoxLayout * lay = new QHBoxLayout(contents);
|
QHBoxLayout * lay = new QHBoxLayout(contents);
|
||||||
lay->setSpacing(KDialog::spacingHint());
|
lay->setSpacing(KDialog::spacingHint());
|
||||||
|
|
||||||
QLabel *label1 = new QLabel( contents);
|
KPixmapWidget *pixmap1 = new KPixmapWidget( contents);
|
||||||
QPixmap pixmap = KIconLoader::global()->loadIcon("dialog-warning", KIconLoader::NoGroup, KIconLoader::SizeMedium, KIconLoader::DefaultState, QStringList(), 0, true);
|
QPixmap pixmap = KIconLoader::global()->loadIcon("dialog-warning", KIconLoader::NoGroup, KIconLoader::SizeMedium, KIconLoader::DefaultState, QStringList(), 0, true);
|
||||||
if (pixmap.isNull())
|
if (pixmap.isNull())
|
||||||
pixmap = QMessageBox::standardIcon(QMessageBox::Warning);
|
pixmap = QMessageBox::standardIcon(QMessageBox::Warning);
|
||||||
label1->setPixmap(pixmap);
|
pixmap1->setPixmap(pixmap);
|
||||||
|
|
||||||
lay->addWidget( label1, 0, Qt::AlignCenter );
|
lay->addWidget( pixmap1, 0, Qt::AlignCenter );
|
||||||
lay->addSpacing(KDialog::spacingHint());
|
lay->addSpacing(KDialog::spacingHint());
|
||||||
|
|
||||||
QVBoxLayout * vlay = new QVBoxLayout();
|
QVBoxLayout * vlay = new QVBoxLayout();
|
||||||
|
|
|
@ -52,21 +52,48 @@
|
||||||
|
|
||||||
static const int ThemeNameRole = Qt::UserRole + 1;
|
static const int ThemeNameRole = Qt::UserRole + 1;
|
||||||
|
|
||||||
|
static void loadPreview(KPixmapWidget *widget, KIconTheme& icontheme, const QStringList& iconnames)
|
||||||
|
{
|
||||||
|
const int size = qMin(48, icontheme.defaultSize(KIconLoader::Desktop));
|
||||||
|
const QStringList iconthemenames = QStringList()
|
||||||
|
<< icontheme.internalName()
|
||||||
|
<< icontheme.inherits();
|
||||||
|
foreach(const QString &iconthemename, iconthemenames) {
|
||||||
|
foreach(const QString &name, iconnames) {
|
||||||
|
KIconTheme kicontheme(iconthemename);
|
||||||
|
QString icon = kicontheme.iconPath(QString("%1.png").arg(name), size, KIconLoader::MatchBest);
|
||||||
|
if (!icon.isEmpty()) {
|
||||||
|
widget->setPixmap(QPixmap(icon).scaled(size, size));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
icon = kicontheme.iconPath(QString("%1.svg").arg(name), size, KIconLoader::MatchBest);
|
||||||
|
if (icon.isEmpty() ) {
|
||||||
|
icon = kicontheme.iconPath(QString("%1.svgz").arg(name), size, KIconLoader::MatchBest);
|
||||||
|
}
|
||||||
|
if (!icon.isEmpty()) {
|
||||||
|
widget->setPixmap(QPixmap(icon).scaled(size, size));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
widget->setPixmap(QPixmap());
|
||||||
|
}
|
||||||
|
|
||||||
IconThemesConfig::IconThemesConfig(const KComponentData &inst, QWidget *parent)
|
IconThemesConfig::IconThemesConfig(const KComponentData &inst, QWidget *parent)
|
||||||
: KCModule(inst, parent)
|
: KCModule(inst, parent)
|
||||||
{
|
{
|
||||||
QVBoxLayout *topLayout = new QVBoxLayout(this);
|
QVBoxLayout *topLayout = new QVBoxLayout(this);
|
||||||
|
|
||||||
QFrame *m_preview=new QFrame(this);
|
QFrame *m_preview = new QFrame(this);
|
||||||
m_preview->setMinimumHeight(80);
|
m_preview->setMinimumHeight(80);
|
||||||
|
|
||||||
QHBoxLayout *lh2=new QHBoxLayout( m_preview );
|
QHBoxLayout *lh2 = new QHBoxLayout( m_preview );
|
||||||
lh2->setSpacing(0);
|
lh2->setSpacing(0);
|
||||||
m_previewExec=new QLabel(m_preview);
|
m_previewExec = new KPixmapWidget(m_preview);
|
||||||
m_previewExec->setPixmap(DesktopIcon("system-run"));
|
m_previewExec->setPixmap(DesktopIcon("system-run"));
|
||||||
m_previewFolder=new QLabel(m_preview);
|
m_previewFolder = new KPixmapWidget(m_preview);
|
||||||
m_previewFolder->setPixmap(DesktopIcon("folder"));
|
m_previewFolder->setPixmap(DesktopIcon("folder"));
|
||||||
m_previewDocument=new QLabel(m_preview);
|
m_previewDocument=new KPixmapWidget(m_preview);
|
||||||
m_previewDocument->setPixmap(DesktopIcon("document"));
|
m_previewDocument->setPixmap(DesktopIcon("document"));
|
||||||
|
|
||||||
lh2->addStretch(10);
|
lh2->addStretch(10);
|
||||||
|
@ -364,33 +391,6 @@ void IconThemesConfig::updateRemoveButton()
|
||||||
m_removeButton->setEnabled(enabled);
|
m_removeButton->setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadPreview(QLabel *label, KIconTheme& icontheme, const QStringList& iconnames)
|
|
||||||
{
|
|
||||||
const int size = qMin(48, icontheme.defaultSize(KIconLoader::Desktop));
|
|
||||||
const QStringList iconthemenames = QStringList()
|
|
||||||
<< icontheme.internalName()
|
|
||||||
<< icontheme.inherits();
|
|
||||||
foreach(const QString &iconthemename, iconthemenames) {
|
|
||||||
foreach(const QString &name, iconnames) {
|
|
||||||
KIconTheme kicontheme(iconthemename);
|
|
||||||
QString icon = kicontheme.iconPath(QString("%1.png").arg(name), size, KIconLoader::MatchBest);
|
|
||||||
if (!icon.isEmpty()) {
|
|
||||||
label->setPixmap(QPixmap(icon).scaled(size, size));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
icon = kicontheme.iconPath(QString("%1.svg").arg(name), size, KIconLoader::MatchBest);
|
|
||||||
if (icon.isEmpty() ) {
|
|
||||||
icon = kicontheme.iconPath(QString("%1.svgz").arg(name), size, KIconLoader::MatchBest);
|
|
||||||
}
|
|
||||||
if (!icon.isEmpty()) {
|
|
||||||
label->setPixmap(QPixmap(icon).scaled(size, size));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
label->setPixmap(QPixmap());
|
|
||||||
}
|
|
||||||
|
|
||||||
void IconThemesConfig::themeSelected(QTreeWidgetItem *item)
|
void IconThemesConfig::themeSelected(QTreeWidgetItem *item)
|
||||||
{
|
{
|
||||||
if (!item) {
|
if (!item) {
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
|
|
||||||
#include <kcmodule.h>
|
#include <kcmodule.h>
|
||||||
#include <kpushbutton.h>
|
#include <kpushbutton.h>
|
||||||
|
#include <kpixmapwidget.h>
|
||||||
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QTreeWidget>
|
#include <QTreeWidget>
|
||||||
#include <QTreeWidgetItem>
|
#include <QTreeWidgetItem>
|
||||||
|
@ -59,9 +59,9 @@ private:
|
||||||
QTreeWidget *m_iconThemes;
|
QTreeWidget *m_iconThemes;
|
||||||
KPushButton *m_removeButton;
|
KPushButton *m_removeButton;
|
||||||
|
|
||||||
QLabel *m_previewExec;
|
KPixmapWidget *m_previewExec;
|
||||||
QLabel *m_previewFolder;
|
KPixmapWidget *m_previewFolder;
|
||||||
QLabel *m_previewDocument;
|
KPixmapWidget *m_previewDocument;
|
||||||
QTreeWidgetItem *m_defaultTheme;
|
QTreeWidgetItem *m_defaultTheme;
|
||||||
bool m_bChanged;
|
bool m_bChanged;
|
||||||
};
|
};
|
||||||
|
|
|
@ -102,12 +102,12 @@ void InfoPanel::setBottomInfo(QVListLayout *lay)
|
||||||
setBottomWidgetLayout(lay);
|
setBottomWidgetLayout(lay);
|
||||||
}
|
}
|
||||||
|
|
||||||
QLabel *InfoPanel::setDevicesIcon(const QIcon &deviceIcon)
|
KPixmapWidget *InfoPanel::setDevicesIcon(const QIcon &deviceIcon)
|
||||||
{
|
{
|
||||||
QLabel *iconLabel = new QLabel();
|
KPixmapWidget *iconWidget = new KPixmapWidget();
|
||||||
|
|
||||||
iconLabel->setPixmap(deviceIcon.pixmap(QSize(70,50)));
|
iconWidget->setPixmap(deviceIcon.pixmap(QSize(70,50)));
|
||||||
return iconLabel;
|
return iconWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoPanel::setTopInfo(const QIcon &deviceIcon, Solid::Device *device)
|
void InfoPanel::setTopInfo(const QIcon &deviceIcon, Solid::Device *device)
|
||||||
|
|
|
@ -23,19 +23,18 @@
|
||||||
#ifndef INFOPANEL
|
#ifndef INFOPANEL
|
||||||
#define INFOPANEL
|
#define INFOPANEL
|
||||||
|
|
||||||
// QT
|
// Katie
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
|
||||||
//Solid
|
|
||||||
#include <solid/device.h>
|
|
||||||
#include <solid/deviceinterface.h>
|
|
||||||
|
|
||||||
//KDE
|
//KDE
|
||||||
#include <kicon.h>
|
#include <kicon.h>
|
||||||
#include <kdebug.h>
|
#include <kdebug.h>
|
||||||
#include <klocale.h>
|
#include <klocale.h>
|
||||||
|
#include <kpixmapwidget.h>
|
||||||
|
#include <solid/device.h>
|
||||||
|
#include <solid/deviceinterface.h>
|
||||||
|
|
||||||
//Local
|
//Local
|
||||||
#include "qvlistlayout.h"
|
#include "qvlistlayout.h"
|
||||||
|
@ -63,7 +62,7 @@ class InfoPanel : public QGroupBox
|
||||||
void removeItems(QWidget *);
|
void removeItems(QWidget *);
|
||||||
void setDefaultText();
|
void setDefaultText();
|
||||||
|
|
||||||
QLabel *setDevicesIcon(const QIcon &);
|
KPixmapWidget *setDevicesIcon(const QIcon &);
|
||||||
QVBoxLayout *setAlignedLayout(QWidget *parent, const int & = 0);
|
QVBoxLayout *setAlignedLayout(QWidget *parent, const int & = 0);
|
||||||
|
|
||||||
QWidget *top;
|
QWidget *top;
|
||||||
|
|
|
@ -36,9 +36,9 @@ DefaultBoxWidget::DefaultBoxWidget()
|
||||||
|
|
||||||
void DefaultBoxWidget::createDisplay()
|
void DefaultBoxWidget::createDisplay()
|
||||||
{
|
{
|
||||||
m_iconLabel = new QLabel();
|
m_iconWidget = new KPixmapWidget();
|
||||||
m_iconLabel->setAlignment(Qt::AlignCenter);
|
m_iconWidget->setAlignment(Qt::AlignCenter);
|
||||||
m_iconLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
m_iconWidget->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||||
|
|
||||||
QFont bFont;
|
QFont bFont;
|
||||||
bFont.setBold(true);
|
bFont.setBold(true);
|
||||||
|
@ -61,7 +61,7 @@ void DefaultBoxWidget::createDisplay()
|
||||||
m_info2NameLabel = new QLabel();
|
m_info2NameLabel = new QLabel();
|
||||||
m_info2NameLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
m_info2NameLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
||||||
|
|
||||||
m_layout->addWidget(m_iconLabel,1,1,3,1,Qt::AlignCenter);
|
m_layout->addWidget(m_iconWidget,1,1,3,1,Qt::AlignCenter);
|
||||||
|
|
||||||
m_layout->addWidget(m_info0Label,1,2,1,1);
|
m_layout->addWidget(m_info0Label,1,2,1,1);
|
||||||
m_layout->addWidget(m_info0NameLabel,1,3,1,1);
|
m_layout->addWidget(m_info0NameLabel,1,3,1,1);
|
||||||
|
@ -82,7 +82,7 @@ void DefaultBoxWidget::setLabelTitles(const QString &first, const QString &secon
|
||||||
|
|
||||||
void DefaultBoxWidget::setIcon(const KIcon &icon)
|
void DefaultBoxWidget::setIcon(const KIcon &icon)
|
||||||
{
|
{
|
||||||
m_iconLabel->setPixmap(icon.pixmap(64));
|
m_iconWidget->setPixmap(icon.pixmap(64));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefaultBoxWidget::setLabelOne(const QString &info)
|
void DefaultBoxWidget::setLabelOne(const QString &info)
|
||||||
|
|
|
@ -23,13 +23,14 @@
|
||||||
#ifndef DEFAULTBOXWIDGET
|
#ifndef DEFAULTBOXWIDGET
|
||||||
#define DEFAULTBOXWIDGET
|
#define DEFAULTBOXWIDGET
|
||||||
|
|
||||||
//QT
|
// Katie
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
|
||||||
//KDE
|
// KDE
|
||||||
#include <KIcon>
|
#include <KIcon>
|
||||||
|
#include <KPixmapWidget>
|
||||||
|
|
||||||
class DefaultBoxWidget : public QGroupBox
|
class DefaultBoxWidget : public QGroupBox
|
||||||
{
|
{
|
||||||
|
@ -48,7 +49,7 @@ class DefaultBoxWidget : public QGroupBox
|
||||||
void createDisplay();
|
void createDisplay();
|
||||||
|
|
||||||
QGridLayout *m_layout;
|
QGridLayout *m_layout;
|
||||||
QLabel *m_iconLabel;
|
KPixmapWidget *m_iconWidget;
|
||||||
|
|
||||||
QLabel *m_info0Label;
|
QLabel *m_info0Label;
|
||||||
QLabel *m_info0NameLabel;
|
QLabel *m_info0NameLabel;
|
||||||
|
|
|
@ -38,9 +38,9 @@ ProgressBoxWidget::ProgressBoxWidget()
|
||||||
|
|
||||||
void ProgressBoxWidget::createDisplay()
|
void ProgressBoxWidget::createDisplay()
|
||||||
{
|
{
|
||||||
m_iconLabel = new QLabel();
|
m_iconWidget = new KPixmapWidget();
|
||||||
m_iconLabel->setAlignment(Qt::AlignCenter);
|
m_iconWidget->setAlignment(Qt::AlignCenter);
|
||||||
m_iconLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
m_iconWidget->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||||
|
|
||||||
QFont bFont;
|
QFont bFont;
|
||||||
bFont.setBold(true);
|
bFont.setBold(true);
|
||||||
|
@ -56,7 +56,7 @@ void ProgressBoxWidget::createDisplay()
|
||||||
m_info1Label->setFont(bFont);
|
m_info1Label->setFont(bFont);
|
||||||
m_progressBar = new QProgressBar();
|
m_progressBar = new QProgressBar();
|
||||||
|
|
||||||
m_layout->addWidget(m_iconLabel,1,1,2,1,Qt::AlignCenter);
|
m_layout->addWidget(m_iconWidget,1,1,2,1,Qt::AlignCenter);
|
||||||
|
|
||||||
m_layout->addWidget(m_info0Label,1,2,1,1);
|
m_layout->addWidget(m_info0Label,1,2,1,1);
|
||||||
m_layout->addWidget(m_info0NameLabel,1,3,1,1);
|
m_layout->addWidget(m_info0NameLabel,1,3,1,1);
|
||||||
|
@ -73,7 +73,7 @@ void ProgressBoxWidget::setLabelTitles(const QString &first, const QString &seco
|
||||||
|
|
||||||
void ProgressBoxWidget::setIcon(const KIcon &icon)
|
void ProgressBoxWidget::setIcon(const KIcon &icon)
|
||||||
{
|
{
|
||||||
m_iconLabel->setPixmap(icon.pixmap(64));
|
m_iconWidget->setPixmap(icon.pixmap(64));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProgressBoxWidget::setLabelOne(const QString &info)
|
void ProgressBoxWidget::setLabelOne(const QString &info)
|
||||||
|
|
|
@ -23,14 +23,15 @@
|
||||||
#ifndef PROGRESSBOXWIDGET
|
#ifndef PROGRESSBOXWIDGET
|
||||||
#define PROGRESSBOXWIDGET
|
#define PROGRESSBOXWIDGET
|
||||||
|
|
||||||
//QT
|
// Katie
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QProgressBar>
|
#include <QProgressBar>
|
||||||
|
|
||||||
//KDE
|
// KDE
|
||||||
#include <KIcon>
|
#include <KIcon>
|
||||||
|
#include <KPixmapWidget>
|
||||||
|
|
||||||
class ProgressBoxWidget : public QFrame
|
class ProgressBoxWidget : public QFrame
|
||||||
{
|
{
|
||||||
|
@ -49,7 +50,7 @@ class ProgressBoxWidget : public QFrame
|
||||||
void createDisplay();
|
void createDisplay();
|
||||||
|
|
||||||
QGridLayout *m_layout;
|
QGridLayout *m_layout;
|
||||||
QLabel *m_iconLabel;
|
KPixmapWidget *m_iconWidget;
|
||||||
|
|
||||||
QLabel *m_info0Label;
|
QLabel *m_info0Label;
|
||||||
QLabel *m_info0NameLabel;
|
QLabel *m_info0NameLabel;
|
||||||
|
|
|
@ -18,10 +18,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include "tooltipmanager.h"
|
#include "tooltipmanager.h"
|
||||||
|
|
||||||
#include "kcmtreeitem.h"
|
#include "kcmtreeitem.h"
|
||||||
#include "sidepanel.h"
|
#include "sidepanel.h"
|
||||||
|
|
||||||
#include "ktooltip.h"
|
#include "ktooltip.h"
|
||||||
|
|
||||||
#include <QRect>
|
#include <QRect>
|
||||||
|
@ -41,6 +39,7 @@
|
||||||
|
|
||||||
#include <KIcon>
|
#include <KIcon>
|
||||||
#include <KColorScheme>
|
#include <KColorScheme>
|
||||||
|
#include <KPixmapWidget>
|
||||||
|
|
||||||
class ToolTipManager::Private
|
class ToolTipManager::Private
|
||||||
{
|
{
|
||||||
|
@ -219,13 +218,13 @@ QLayout * ToolTipManager::generateToolTipLine( const QModelIndex & item, QWidget
|
||||||
|
|
||||||
// Get icon
|
// Get icon
|
||||||
KIcon icon( menuItem->icon() );
|
KIcon icon( menuItem->icon() );
|
||||||
QLabel * iconLabel = new QLabel( toolTip );
|
KPixmapWidget * iconWidget = new KPixmapWidget( toolTip );
|
||||||
iconLabel->setPixmap( icon.pixmap(iconSize) );
|
iconWidget->setPixmap( icon.pixmap(iconSize) );
|
||||||
iconLabel->setMaximumSize( iconSize );
|
iconWidget->setMaximumSize( iconSize );
|
||||||
|
|
||||||
// Generate layout
|
// Generate layout
|
||||||
QHBoxLayout * layout = new QHBoxLayout();
|
QHBoxLayout * layout = new QHBoxLayout();
|
||||||
layout->addWidget( iconLabel );
|
layout->addWidget( iconWidget );
|
||||||
layout->addWidget( textLabel );
|
layout->addWidget( textLabel );
|
||||||
|
|
||||||
return layout;
|
return layout;
|
||||||
|
|
|
@ -19,17 +19,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
// Qt
|
// Katie
|
||||||
#include <QtDBus/QtDBus>
|
#include <QDBusMessage>
|
||||||
|
#include <QDBusConnection>
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QtCore/qdebug.h>
|
#include <QDebug>
|
||||||
|
|
||||||
// KDE
|
// KDE
|
||||||
#include <KAction>
|
#include <KAction>
|
||||||
#include <KActionCollection>
|
#include <KActionCollection>
|
||||||
#include <KCModuleProxy>
|
#include <KCModuleProxy>
|
||||||
//#include <KLocalizedString>
|
|
||||||
#include <KPluginFactory>
|
#include <KPluginFactory>
|
||||||
#include <KPluginInfo>
|
#include <KPluginInfo>
|
||||||
#include <KPluginLoader>
|
#include <KPluginLoader>
|
||||||
|
|
|
@ -40,7 +40,7 @@ QIconItem::~QIconItem()
|
||||||
|
|
||||||
void QIconItem::setIcon(const QVariant &icon)
|
void QIconItem::setIcon(const QVariant &icon)
|
||||||
{
|
{
|
||||||
if(icon.canConvert<QIcon>()) {
|
if (icon.canConvert<QIcon>()) {
|
||||||
m_icon = icon.value<QIcon>();
|
m_icon = icon.value<QIcon>();
|
||||||
} else if(icon.canConvert<QString>()) {
|
} else if(icon.canConvert<QString>()) {
|
||||||
m_icon = KIcon(icon.toString());
|
m_icon = KIcon(icon.toString());
|
||||||
|
|
|
@ -18,9 +18,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include "tooltipmanager.h"
|
#include "tooltipmanager.h"
|
||||||
|
|
||||||
#include "MenuItem.h"
|
#include "MenuItem.h"
|
||||||
|
|
||||||
#include "ktooltip.h"
|
#include "ktooltip.h"
|
||||||
|
|
||||||
#include <QRect>
|
#include <QRect>
|
||||||
|
@ -41,6 +39,7 @@
|
||||||
#include <KIcon>
|
#include <KIcon>
|
||||||
#include <KIconLoader>
|
#include <KIconLoader>
|
||||||
#include <KColorScheme>
|
#include <KColorScheme>
|
||||||
|
#include <KPixmapWidget>
|
||||||
|
|
||||||
class ToolTipManager::Private
|
class ToolTipManager::Private
|
||||||
{
|
{
|
||||||
|
@ -234,13 +233,13 @@ QLayout * ToolTipManager::generateToolTipLine( QModelIndex * item, QWidget * too
|
||||||
|
|
||||||
// Get icon
|
// Get icon
|
||||||
KIcon icon( menuItem->service()->icon() );
|
KIcon icon( menuItem->service()->icon() );
|
||||||
QLabel * iconLabel = new QLabel( toolTip );
|
KPixmapWidget * iconWidget = new KPixmapWidget( toolTip );
|
||||||
iconLabel->setPixmap( icon.pixmap(iconSize) );
|
iconWidget->setPixmap( icon.pixmap(iconSize) );
|
||||||
iconLabel->setMaximumSize( iconSize );
|
iconWidget->setMaximumSize( iconSize );
|
||||||
|
|
||||||
// Generate layout
|
// Generate layout
|
||||||
QHBoxLayout * layout = new QHBoxLayout();
|
QHBoxLayout * layout = new QHBoxLayout();
|
||||||
layout->addWidget( iconLabel );
|
layout->addWidget( iconWidget );
|
||||||
layout->addWidget( textLabel );
|
layout->addWidget( textLabel );
|
||||||
|
|
||||||
return layout;
|
return layout;
|
||||||
|
|
Loading…
Add table
Reference in a new issue