rewrote Button and ToggleButton to use the new PixmapButton as baseclass.
This commit is contained in:
parent
e2fdb4e009
commit
efa16e9236
15 changed files with 115 additions and 146 deletions
|
@ -162,18 +162,6 @@ PlaylistScrollBar::sliderValueFromPosition (int position)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* dragButton
|
||||
*/
|
||||
void
|
||||
dragButton::mouseMoveEvent (QMouseEvent *event)
|
||||
{
|
||||
PlaylistWindow *pw = dynamic_cast<PlaylistWindow *>(window ());
|
||||
pw->resize (pw->size().width()+(event->pos().x()-m_diffx),
|
||||
pw->size().height()+(event->pos().y()-m_diffy));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* PlaylistWindow
|
||||
*/
|
||||
|
@ -210,11 +198,13 @@ PlaylistWindow::PlaylistWindow (QWidget *parent) : QMainWindow (parent)
|
|||
s.setValue ("shaded", false);
|
||||
else
|
||||
s.setValue ("shaded", !s.value("shaded").toBool ());
|
||||
|
||||
|
||||
switchDisplay ();
|
||||
|
||||
s.endGroup ();
|
||||
|
||||
// FIXME: flickering
|
||||
//setSizeIncrement (25, 29);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -340,17 +330,16 @@ PlaylistWidget::PlaylistWidget (QWidget *parent) : QWidget (parent)
|
|||
connect (m_scrollBar, SIGNAL(valueChanged (int)),
|
||||
m_view, SLOT(verticalScrollbarValueChanged (int)));
|
||||
|
||||
m_sizegrip = new PlaylistSizeGrip(this);
|
||||
m_sizegrip->resize (20, 20);
|
||||
|
||||
m_drag = new dragButton (this);
|
||||
m_drag->resize (30, 30);
|
||||
|
||||
addButtons ();
|
||||
|
||||
setMinimumSize (275, 116);
|
||||
resize (275, 300);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
PlaylistWidget::addButtons (void)
|
||||
{
|
||||
PlaylistMenuButton *b;
|
||||
|
@ -493,9 +482,9 @@ PlaylistWidget::resizeEvent (QResizeEvent *event)
|
|||
m_scrollBar->resize (m_rfill2.width(),
|
||||
size().height()-m_corner2.height()-m_corner4.height());
|
||||
|
||||
/* drag corner */
|
||||
m_drag->move (size().width()-30,
|
||||
size().height()-30);
|
||||
/* place the sizegrip in the lower right corner */
|
||||
m_sizegrip->move( size().width() - m_sizegrip->width(),
|
||||
size().height() - m_sizegrip->height() );
|
||||
|
||||
/* move menus */
|
||||
m_add->move (11, height() - m_add->height() - 12);
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <QMainWindow>
|
||||
#include <QFont>
|
||||
#include <QScrollBar>
|
||||
#include <QSizeGrip>
|
||||
|
||||
class MainWindow;
|
||||
class PlaylistWidget;
|
||||
|
@ -35,7 +36,17 @@ class PlaylistView;
|
|||
class PlaylistShade;
|
||||
class PlaylistMenu;
|
||||
|
||||
class PlaylistSizeGrip : public QSizeGrip {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PlaylistSizeGrip (QWidget *parent) : QSizeGrip (parent) {}
|
||||
~PlaylistSizeGrip () {}
|
||||
|
||||
public slots:
|
||||
void paintEvent (QPaintEvent *event) {}
|
||||
|
||||
};
|
||||
|
||||
class PlaylistScrollBar : public QScrollBar {
|
||||
Q_OBJECT
|
||||
|
@ -62,15 +73,6 @@ class PlaylistScrollBar : public QScrollBar {
|
|||
};
|
||||
|
||||
|
||||
class dragButton : public Button {
|
||||
public:
|
||||
dragButton (QWidget *parent) : Button (parent) {}
|
||||
~dragButton () {}
|
||||
|
||||
void mouseMoveEvent (QMouseEvent *event);
|
||||
};
|
||||
|
||||
|
||||
class PlaylistWidget : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -112,7 +114,7 @@ class PlaylistWidget : public QWidget {
|
|||
|
||||
PlaylistView *m_view;
|
||||
QScrollBar *m_scrollBar;
|
||||
dragButton *m_drag;
|
||||
PlaylistSizeGrip *m_sizegrip;
|
||||
|
||||
PlaylistMenu *m_add;
|
||||
PlaylistMenu *m_del;
|
||||
|
|
|
@ -94,18 +94,18 @@ PlaylistView::PlaylistView (QWidget *parent) : QListView (parent)
|
|||
if (!s.contains ("playlist/fontsize"))
|
||||
s.setValue ("playlist/fontsize", 10);
|
||||
|
||||
// Background is painted by PlaylistWidget
|
||||
setAttribute (Qt::WA_NoBackground);
|
||||
// TODO make drag and drop work
|
||||
setDragEnabled(true);
|
||||
setAcceptDrops(true);
|
||||
// end DragandDrop
|
||||
setFrameStyle(QFrame::NoFrame);
|
||||
setFocusPolicy (Qt::StrongFocus);
|
||||
setSelectionMode (QAbstractItemView::ExtendedSelection);
|
||||
setUniformItemSizes(true);
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
|
||||
setSelectionMode (QAbstractItemView::ExtendedSelection);
|
||||
setUniformItemSizes(true);
|
||||
setDragEnabled(true);
|
||||
setAcceptDrops(true);
|
||||
|
||||
// TODO make sure delegate gets deleted
|
||||
setItemDelegate (new PlaylistDelegate (this));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue