OTHER: removed PixWidget
PixWidget sole purpose was to paint a given pixmap. Some of PixWidgets child classes had to create that pixmap from some other pixmaps. Thus PixWidget introduced some kind of unnecessary double buffering. Furthermore, those pixmaps where created even if a widget wasn't visible. Painting directly to the widget and calling the 'update ()' method on changes might allow Qt to do some performance optimizations. Most likely they will be to small to be noticable though. I also disabled the shortcuts of the titlebarmenu. They were diplayed in the menu but didn't work. As soon as I figure out how to get them working again I will enable them again
This commit is contained in:
parent
6cf0ad2614
commit
096ac37121
11 changed files with 130 additions and 167 deletions
|
@ -21,6 +21,28 @@
|
|||
#include <QPoint>
|
||||
#include <QPainter>
|
||||
|
||||
|
||||
PlaylistMenuBar::PlaylistMenuBar (QWidget *parent, uint id) : QWidget (parent)
|
||||
{
|
||||
m_id = id;
|
||||
|
||||
Skin *skin = Skin::getInstance ();
|
||||
m_pixmap = QPixmap (0,0);
|
||||
|
||||
connect (skin, SIGNAL (skinChanged (Skin *)),
|
||||
this, SLOT (setPixmaps (Skin *)));
|
||||
}
|
||||
|
||||
void
|
||||
PlaylistMenuBar::paintEvent (QPaintEvent *event)
|
||||
{
|
||||
QPainter p;
|
||||
p.begin (this);
|
||||
p.drawPixmap (rect (), m_pixmap, m_pixmap.rect ());
|
||||
p.end ();
|
||||
}
|
||||
|
||||
|
||||
PlaylistMenuButton::PlaylistMenuButton (PlaylistMenu *menu,
|
||||
uint pix1, uint pix2) : QWidget (menu)
|
||||
{
|
||||
|
@ -59,7 +81,7 @@ PlaylistMenuButton::setPixmaps (Skin *skin)
|
|||
* PlaylistMenu
|
||||
*/
|
||||
PlaylistMenu::PlaylistMenu (QWidget *parent, uint pix,
|
||||
uint decoration) : PixWidget (parent)
|
||||
uint decoration) : QWidget (parent)
|
||||
{
|
||||
setFixedSize (25, 18);
|
||||
|
||||
|
@ -70,6 +92,21 @@ PlaylistMenu::PlaylistMenu (QWidget *parent, uint pix,
|
|||
m_decbar->move (0, 0);
|
||||
|
||||
m_pixid = pix;
|
||||
|
||||
Skin *skin = Skin::getInstance ();
|
||||
m_pixmap = QPixmap (0,0);
|
||||
|
||||
connect (skin, SIGNAL (skinChanged (Skin *)),
|
||||
this, SLOT (setPixmaps (Skin *)));
|
||||
}
|
||||
|
||||
void
|
||||
PlaylistMenu::paintEvent (QPaintEvent *event)
|
||||
{
|
||||
QPainter p;
|
||||
p.begin (this);
|
||||
p.drawPixmap (rect (), m_pixmap, m_pixmap.rect ());
|
||||
p.end ();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -16,26 +16,25 @@
|
|||
#ifndef __PLAYLISTMENU_H__
|
||||
#define __PLAYLISTMENU_H__
|
||||
|
||||
class PlaylistMenu;
|
||||
|
||||
//#include "XMMSHandler.h"
|
||||
#include "PixWidget.h"
|
||||
#include <QWidget>
|
||||
#include "Skin.h"
|
||||
|
||||
#include <QWidget>
|
||||
class PlaylistMenu;
|
||||
|
||||
class PlaylistMenuBar : public PixWidget {
|
||||
class PlaylistMenuBar : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
PlaylistMenuBar (QWidget *parent, uint id) : PixWidget (parent)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
PlaylistMenuBar (QWidget *parent, uint id);
|
||||
|
||||
public slots:
|
||||
void setPixmaps (Skin *skin) { m_pixmap = skin->getPls (m_id); }
|
||||
|
||||
protected slots:
|
||||
void paintEvent (QPaintEvent *event);
|
||||
|
||||
private:
|
||||
uint m_id;
|
||||
QPixmap m_pixmap;
|
||||
};
|
||||
|
||||
class PlaylistMenuButton : public QWidget {
|
||||
|
@ -65,7 +64,7 @@ class PlaylistMenuButton : public QWidget {
|
|||
QPixmap m_pixmap;
|
||||
};
|
||||
|
||||
class PlaylistMenu : public PixWidget {
|
||||
class PlaylistMenu : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
PlaylistMenu (QWidget *, uint, uint);
|
||||
|
@ -81,6 +80,9 @@ class PlaylistMenu : public PixWidget {
|
|||
public slots:
|
||||
void setPixmaps (Skin *skin);
|
||||
|
||||
protected slots:
|
||||
void paintEvent (QPaintEvent *event);
|
||||
|
||||
private:
|
||||
uint m_pixid;
|
||||
uint m_dec;
|
||||
|
@ -90,6 +92,7 @@ class PlaylistMenu : public PixWidget {
|
|||
|
||||
PlaylistMenuBar *m_decbar;
|
||||
|
||||
QPixmap m_pixmap;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue