Very basic windowsnapping now works.
This commit is contained in:
parent
30dd3acee6
commit
479aecb564
2 changed files with 23 additions and 0 deletions
|
@ -31,6 +31,7 @@ MainWindow::MainWindow (QWidget *parent) : QMainWindow (parent)
|
|||
*/
|
||||
m_isshaded = false;
|
||||
|
||||
m_playlistwin = NULL;
|
||||
|
||||
}
|
||||
|
||||
|
@ -59,6 +60,27 @@ MainWindow::switchDisplay ()
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
MainWindow::moveEvent (QMoveEvent *event)
|
||||
{
|
||||
int x = event->oldPos().x();
|
||||
int y = event->oldPos().y() + size().height();
|
||||
|
||||
if (!m_playlistwin)
|
||||
return;
|
||||
|
||||
int x2 = m_playlistwin->pos().x();
|
||||
int y2 = m_playlistwin->pos().y();
|
||||
|
||||
int diffy = y - y2;
|
||||
int diffx = x - x2;
|
||||
|
||||
if ((diffy > -5 && diffy < 5) && (diffx > -10 && diffx < 10))
|
||||
{
|
||||
m_playlistwin->move (event->pos().x(),
|
||||
event->pos().y() + size().height());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MainWindow::togglePL (void)
|
||||
|
|
|
@ -33,6 +33,7 @@ class MainWindow : public QMainWindow
|
|||
|
||||
bool getShaded (void) { return m_isshaded; }
|
||||
void setPL (PlaylistWindow *p) { m_playlistwin = p; }
|
||||
void moveEvent (QMoveEvent *event);
|
||||
|
||||
public slots:
|
||||
void switchDisplay ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue