[vlc-commits] [Git][videolan/vlc][master] 3 commits: qt: set transient parent in QVLCFrame if it is a window

Steve Lhomme (@robUx4) gitlab at videolan.org
Sun Jul 21 12:24:48 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
e7f202d0 by Fatih Uzunoglu at 2024-07-21T12:08:33+00:00
qt: set transient parent in QVLCFrame if it is a window

- - - - -
8f4c4710 by Fatih Uzunoglu at 2024-07-21T12:08:33+00:00
qml: set transient parent in WindowDialog

- - - - -
7d523406 by Fatih Uzunoglu at 2024-07-21T12:08:33+00:00
qt: remove unused class QVLCMW

Widget based user interface is no longer used,
`QMainWindow` (which is a `QWidget`) is no longer
useful.

- - - - -


3 changed files:

- modules/gui/qt/dialogs/dialogs/qml/WindowDialog.qml
- modules/gui/qt/widgets/native/qvlcframe.cpp
- modules/gui/qt/widgets/native/qvlcframe.hpp


Changes:

=====================================
modules/gui/qt/dialogs/dialogs/qml/WindowDialog.qml
=====================================
@@ -27,6 +27,8 @@ import VLC.Style
 Window {
     id: root
 
+    transientParent: MainCtx.intfMainWindow
+
     flags: Qt.Dialog
 
     property bool modal: false


=====================================
modules/gui/qt/widgets/native/qvlcframe.cpp
=====================================
@@ -196,6 +196,17 @@ bool QVLCTools::restoreWidgetPosition(qt_intf_t *p_intf,
     return defaultUsed;
 }
 
+QVLCFrame::QVLCFrame(qt_intf_t *_p_intf) : QWidget( NULL ), p_intf( _p_intf )
+{
+    assert(_p_intf);
+
+    if (windowFlags().testFlag(Qt::Window))
+    {
+        // If window, set the transient parent:
+        QVLCDialog::setWindowTransientParent(this, nullptr, p_intf);
+    }
+}
+
 void QVLCFrame::keyPressEvent(QKeyEvent *keyEvent)
 {
     if (keyEvent->key() == Qt::Key_Escape)


=====================================
modules/gui/qt/widgets/native/qvlcframe.hpp
=====================================
@@ -72,8 +72,7 @@ class QVLCTools
 class QVLCFrame : public QWidget
 {
 public:
-    QVLCFrame( qt_intf_t *_p_intf ) : QWidget( NULL ), p_intf( _p_intf )
-    {}
+    QVLCFrame( qt_intf_t *_p_intf );
     virtual ~QVLCFrame()   {}
 
     void toggleVisible()
@@ -134,50 +133,4 @@ protected:
     void keyPressEvent( QKeyEvent *keyEvent ) override;
 };
 
-class QVLCMW : public QMainWindow
-{
-public:
-    QVLCMW( qt_intf_t *_p_intf,QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags() )
-        : QMainWindow( parent, flags )
-        , p_intf( _p_intf )
-    {}
-
-    void toggleVisible()
-    {
-        if( isVisible() ) hide();
-        else show();
-    }
-protected:
-    qt_intf_t *p_intf;
-    QSize mainSize;
-
-    void readSettings( const QString& name, QSize defSize )
-    {
-        QVLCTools::restoreWidgetPosition( p_intf, name, this, defSize);
-    }
-
-    void readSettings( const QString& name )
-    {
-        QVLCTools::restoreWidgetPosition( p_intf, name, this);
-    }
-    void readSettings( QSettings *settings )
-    {
-        QVLCTools::restoreWidgetPosition(settings, this);
-    }
-
-    void readSettings( QSettings *settings, QSize defSize)
-    {
-        QVLCTools::restoreWidgetPosition(settings, this, defSize);
-    }
-
-    void writeSettings( const QString& name )
-    {
-        QVLCTools::saveWidgetPosition( p_intf, name, this);
-    }
-    void writeSettings(QSettings *settings )
-    {
-        QVLCTools::saveWidgetPosition(settings, this);
-    }
-};
-
 #endif



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3bf4d48c2d51f7f6897885c7ca214824e56350db...7d523406931ccf618ad83c5aa8f23118de3ddf40

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3bf4d48c2d51f7f6897885c7ca214824e56350db...7d523406931ccf618ad83c5aa8f23118de3ddf40
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list