Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Quickview and layouts
QtWS25 Last Chance

Quickview and layouts

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 2 Posters 1.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    celica
    wrote on last edited by
    #1

    Hi,
    I have a mainwindow on which a QHBoxLayout is applied.
    To this 2 quickviews are added (which in turn 2 widgets are added) which house my tumbler.
    And both of these widgets are applied to the QHBoxLayout layout.

    In the background of the mainwindow a movie is running.
    But the quickview overlays this movie in white.
    If I apply a stretch it does shrink it but as you can see from the pic the top and bottom are still white.
    https://ibb.co/0s0qwPf
    Is there any way to just have the quickview cover the qml contents only leaving the surrounding area free to display the movie.
    I have tried anchors.fill: parent within qml but this doesn’t work.

    mstrWnd = new QWidget;                                                                                      //Creater main window widget
    mstrWnd->setObjectName(STR_MASTER_WINDOW_NAME);               
    mstrWnd->setWindowTitle(getSettingI(MSTR_APP_TITLE));                     //Assgin window title
    mstrWnd->setGeometry(getSettingI(MSTR_APP_X).toInt(),                       /Set default X position
    getSettingI(MSTR_APP_Y).toInt(),                                                                       //Set default Y position
    getSettingI(MSTR_APP_WIDTH).toInt(),                                                                 //Set default width
    getSettingI(MSTR_APP_HEIGHT).toInt());                                                              //Set default height
    mstrWnd->setWindowFlags(Qt::FramelessWindowHint | Qt::Window);
    mstrWnd->setWindowState(Qt::WindowFullScreen);
    
    QHBoxLayout* laos = new QHBoxLayout();
    mstrWnd->setLayout(laos);
    quickView = new QQuickView(QUrl::fromLocalFile(QDir::currentPath() + "\\Resources\\videos\\aos.qml"));
    quickView->setResizeMode(QQuickView::SizeRootObjectToView);
    quickWidgettum = new QWidget;
    quickWidgettum = QWidget::createWindowContainer(quickView);
    quickWidgettum->setWindowFlags(Qt::FramelessWindowHint | Qt::Window);
    laos->addWidget(quickWidgettum,15);
     
    quickViewdate = new QQuickView(QUrl::fromLocalFile(QDir::currentPath() + "\\Resources\\videos\\aosdate.qml"));
    quickViewdate->setResizeMode(QQuickView::SizeRootObjectToView);
    quickWidgetdate = new QWidget;
    quickWidgetdate = QWidget::createWindowContainer(quickViewdate);
    quickWidgetdate->setWindowFlags(Qt::FramelessWindowHint | Qt::Window);
    laos->addWidget(quickWidgetdate);
    
    QML
    Rectangle 
    {
    	width: 400
    	height: 400
    	x:115
    	y:230
    	Column 
    	{ 
    		/* outer column */
    		spacing: 10
    		Column 
    		{ /* inner column */
    			x: 10; y: 10
    			spacing: 10
    			Rectangle 
    			{ 
    				width: 180; height: 200; //color: "red" 
    				Frame 
    				{
    					FontMetrics 
    					{
    						id: fontMetrics
    					}
    					id: frame
    					padding: 0
    					Row 
    					{
    						id: row
    						Tumbler 
    						{ 							
    							id: hoursTumbler
    							objectName: "hour"
    							model: ["1", "2","3", "4","5", "6","7", "8","9", "10","11", "12"]
    							delegate: delegateComponent
    							readonly property int hourcode: hoursTumbler.currentIndex + 1
    						}
    
    						Tumbler 
    						{
    							id: minutesTumbler
    							objectName: "min"
    							model: 60
    							delegate: delegateComponent
    							readonly property int mincode: minutesTumbler.currentIndex
    						}
    
    						Tumbler 
    						{
    							objectName: "ampm"
    							id: amPmTumbler
    							model: ["AM", "PM"]
    							delegate: delegateComponent
    							readonly property string ampmcode: amPmTumbler.currentIndex
    						}
    					}
    				}
    			}
    		}
    	}
    }
    
    J.HilkJ 1 Reply Last reply
    0
    • C celica

      Hi,
      I have a mainwindow on which a QHBoxLayout is applied.
      To this 2 quickviews are added (which in turn 2 widgets are added) which house my tumbler.
      And both of these widgets are applied to the QHBoxLayout layout.

      In the background of the mainwindow a movie is running.
      But the quickview overlays this movie in white.
      If I apply a stretch it does shrink it but as you can see from the pic the top and bottom are still white.
      https://ibb.co/0s0qwPf
      Is there any way to just have the quickview cover the qml contents only leaving the surrounding area free to display the movie.
      I have tried anchors.fill: parent within qml but this doesn’t work.

      mstrWnd = new QWidget;                                                                                      //Creater main window widget
      mstrWnd->setObjectName(STR_MASTER_WINDOW_NAME);               
      mstrWnd->setWindowTitle(getSettingI(MSTR_APP_TITLE));                     //Assgin window title
      mstrWnd->setGeometry(getSettingI(MSTR_APP_X).toInt(),                       /Set default X position
      getSettingI(MSTR_APP_Y).toInt(),                                                                       //Set default Y position
      getSettingI(MSTR_APP_WIDTH).toInt(),                                                                 //Set default width
      getSettingI(MSTR_APP_HEIGHT).toInt());                                                              //Set default height
      mstrWnd->setWindowFlags(Qt::FramelessWindowHint | Qt::Window);
      mstrWnd->setWindowState(Qt::WindowFullScreen);
      
      QHBoxLayout* laos = new QHBoxLayout();
      mstrWnd->setLayout(laos);
      quickView = new QQuickView(QUrl::fromLocalFile(QDir::currentPath() + "\\Resources\\videos\\aos.qml"));
      quickView->setResizeMode(QQuickView::SizeRootObjectToView);
      quickWidgettum = new QWidget;
      quickWidgettum = QWidget::createWindowContainer(quickView);
      quickWidgettum->setWindowFlags(Qt::FramelessWindowHint | Qt::Window);
      laos->addWidget(quickWidgettum,15);
       
      quickViewdate = new QQuickView(QUrl::fromLocalFile(QDir::currentPath() + "\\Resources\\videos\\aosdate.qml"));
      quickViewdate->setResizeMode(QQuickView::SizeRootObjectToView);
      quickWidgetdate = new QWidget;
      quickWidgetdate = QWidget::createWindowContainer(quickViewdate);
      quickWidgetdate->setWindowFlags(Qt::FramelessWindowHint | Qt::Window);
      laos->addWidget(quickWidgetdate);
      
      QML
      Rectangle 
      {
      	width: 400
      	height: 400
      	x:115
      	y:230
      	Column 
      	{ 
      		/* outer column */
      		spacing: 10
      		Column 
      		{ /* inner column */
      			x: 10; y: 10
      			spacing: 10
      			Rectangle 
      			{ 
      				width: 180; height: 200; //color: "red" 
      				Frame 
      				{
      					FontMetrics 
      					{
      						id: fontMetrics
      					}
      					id: frame
      					padding: 0
      					Row 
      					{
      						id: row
      						Tumbler 
      						{ 							
      							id: hoursTumbler
      							objectName: "hour"
      							model: ["1", "2","3", "4","5", "6","7", "8","9", "10","11", "12"]
      							delegate: delegateComponent
      							readonly property int hourcode: hoursTumbler.currentIndex + 1
      						}
      
      						Tumbler 
      						{
      							id: minutesTumbler
      							objectName: "min"
      							model: 60
      							delegate: delegateComponent
      							readonly property int mincode: minutesTumbler.currentIndex
      						}
      
      						Tumbler 
      						{
      							objectName: "ampm"
      							id: amPmTumbler
      							model: ["AM", "PM"]
      							delegate: delegateComponent
      							readonly property string ampmcode: amPmTumbler.currentIndex
      						}
      					}
      				}
      			}
      		}
      	}
      }
      
      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @celica

      If I understand you correctly, than that is sadly not possible

      Your background video ( a widget?) and your QQuickView tumbler (qml) have different rendering methods, that don't play nicely with each other
      I was never able to correctly (partially)overlay one over the other


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      C 1 Reply Last reply
      1
      • J.HilkJ J.Hilk

        @celica

        If I understand you correctly, than that is sadly not possible

        Your background video ( a widget?) and your QQuickView tumbler (qml) have different rendering methods, that don't play nicely with each other
        I was never able to correctly (partially)overlay one over the other

        C Offline
        C Offline
        celica
        wrote on last edited by
        #3

        @J-Hilk Ah OK. Thanks for the answer.
        Is there any way to apply a static background image to the quickview so the white part at least is not in stark contrast

        J.HilkJ 1 Reply Last reply
        0
        • C celica

          @J-Hilk Ah OK. Thanks for the answer.
          Is there any way to apply a static background image to the quickview so the white part at least is not in stark contrast

          J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by
          #4

          @celica
          sure,
          Rectangle has a color: property for the background and if you really want a Picture, replace the Rectangle with a Image object :)


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          C 2 Replies Last reply
          2
          • J.HilkJ J.Hilk

            @celica
            sure,
            Rectangle has a color: property for the background and if you really want a Picture, replace the Rectangle with a Image object :)

            C Offline
            C Offline
            celica
            wrote on last edited by
            #5

            @J-Hilk Great thanks.
            Would you know how to shrink the quickview so just the tumbler is visible as this is all that is in that widget within the quickview as in this pic - https://ibb.co/N3PXQdD

            1 Reply Last reply
            0
            • J.HilkJ J.Hilk

              @celica
              sure,
              Rectangle has a color: property for the background and if you really want a Picture, replace the Rectangle with a Image object :)

              C Offline
              C Offline
              celica
              wrote on last edited by
              #6

              @J-Hilk Hi
              That worked great, thanks a lot.

              One last question. If you look at the pic attached.
              The second quickview widget (quickWidgetdate ) is shifted off to the right within the QHBoxlayout.
              Is there a way to move this over to the left manually.
              At the moment it is aligned to the center of the screen of the application on which it executes.

              https://ibb.co/jffdjJF

              J.HilkJ 1 Reply Last reply
              0
              • C celica

                @J-Hilk Hi
                That worked great, thanks a lot.

                One last question. If you look at the pic attached.
                The second quickview widget (quickWidgetdate ) is shifted off to the right within the QHBoxlayout.
                Is there a way to move this over to the left manually.
                At the moment it is aligned to the center of the screen of the application on which it executes.

                https://ibb.co/jffdjJF

                J.HilkJ Offline
                J.HilkJ Offline
                J.Hilk
                Moderators
                wrote on last edited by
                #7

                hi @celica sorry for the delay, busy weekend :)

                I'm not quite sure what is the cause for this. If you do not have a margin set in your Layout, than the issue has to be in the QML code. Could you post your QML code ?


                Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                Q: What's that?
                A: It's blue light.
                Q: What does it do?
                A: It turns blue.

                C 1 Reply Last reply
                0
                • J.HilkJ J.Hilk

                  hi @celica sorry for the delay, busy weekend :)

                  I'm not quite sure what is the cause for this. If you do not have a margin set in your Layout, than the issue has to be in the QML code. Could you post your QML code ?

                  C Offline
                  C Offline
                  celica
                  wrote on last edited by
                  #8

                  @J-Hilk No problem. I actually resolved this in the meantime.
                  What i did was instead of having 2 quickviews which were difficult to organize, I loaded both tumblers using one quickview instance. Thanks for the help.

                  1 Reply Last reply
                  1

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved