diff --git a/app/mainwindow.h b/app/mainwindow.h --- a/app/mainwindow.h +++ b/app/mainwindow.h @@ -54,6 +54,8 @@ Q_OBJECT Q_CLASSINFO("D-Bus Interface", "org.kde.yakuake") + friend class TitleBar; + public: explicit MainWindow(QWidget* parent = 0); ~MainWindow(); diff --git a/app/titlebar.h b/app/titlebar.h --- a/app/titlebar.h +++ b/app/titlebar.h @@ -24,6 +24,7 @@ #include +#include class MainWindow; @@ -55,6 +56,7 @@ protected: void resizeEvent(QResizeEvent*) override; void paintEvent(QPaintEvent*) override; + void mouseMoveEvent(QMouseEvent*) override; private: diff --git a/app/titlebar.cpp b/app/titlebar.cpp --- a/app/titlebar.cpp +++ b/app/titlebar.cpp @@ -61,6 +61,8 @@ m_quitButton->setToolTip(xi18nc("@info:tooltip Quits the application", "Quit")); m_quitButton->setWhatsThis(xi18nc("@info:whatsthis", "Quits the application.")); connect(m_quitButton, SIGNAL(clicked()), mainWindow, SLOT(close())); + + setCursor(Qt::SizeVerCursor); } TitleBar::~TitleBar() @@ -138,6 +140,27 @@ painter.end(); } +void TitleBar::mouseMoveEvent(QMouseEvent* event) +{ + if (event->buttons() == Qt::LeftButton) { + MainWindow* window = dynamic_cast( parent() ); + + int maxHeight = window->getDesktopGeometry().height(); + int newHeight = event->globalY() / (maxHeight / 100); + + if (newHeight > 100) { + newHeight = 100; + } + if (newHeight < 10) { + newHeight = 10; + } + + window->setWindowHeight(newHeight); + } else { + QWidget::mouseMoveEvent(event); + } +} + void TitleBar::updateMask() { const QPixmap& leftCornerImage = m_skin->titleBarLeftCornerImage();