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. Maximized MainWindow on Win10 TabletMode

Maximized MainWindow on Win10 TabletMode

Scheduled Pinned Locked Moved Solved General and Desktop
qt5.5windows 10tablet mode
8 Posts 3 Posters 2.9k 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.
  • the_T Offline
    the_T Offline
    the_
    wrote on last edited by
    #1

    Hi all,

    I have a strange behaviour with an application i wrote some time ago. When I try to start it on Win10 in the "Tablet Mode" the window does not go to maximized, even the icon in the window title shows maximized. THe strange thing is, that this happens not all time i try to start this program (3 out of 10 starting correct).
    It works in "Desktop Mode" on WIn10 , also on Win7 and Win 8/8.1 although i have to show the mainwindow with

    w.showMaximized();
    w.showNormal();
    w.showMaximized();
    

    to have the window really maximized.

    Has anyone a solution to have a correctly maximized window in TabletMode?

    thanks

    br
    R

    -- No support in PM --

    1 Reply Last reply
    0
    • ValentinMicheletV Offline
      ValentinMicheletV Offline
      ValentinMichelet
      wrote on last edited by ValentinMichelet
      #2

      Hi, welcome to Devnet.

      Not sure this is going to work any better, but you can try setWindowState instead:

      w.setWindowState(Qt::WindowMaximized);
      
      1 Reply Last reply
      0
      • the_T Offline
        the_T Offline
        the_
        wrote on last edited by
        #3

        Hi,

        Thanks for that hint

        It works as expected when I compile it for Debug but not for Release on Win8.1.
        As Release Build it still shows the MainWindow in original size with the Maximized icon in the window title.
        I can't try on Win10 for now because i do not have any device available at the moment.

        -- No support in PM --

        ValentinMicheletV 1 Reply Last reply
        0
        • the_T the_

          Hi,

          Thanks for that hint

          It works as expected when I compile it for Debug but not for Release on Win8.1.
          As Release Build it still shows the MainWindow in original size with the Maximized icon in the window title.
          I can't try on Win10 for now because i do not have any device available at the moment.

          ValentinMicheletV Offline
          ValentinMicheletV Offline
          ValentinMichelet
          wrote on last edited by
          #4

          I'll need your code to understand what is going on.
          What is the type of your w variable? Do you set some flags manually? sometimes it causes glitches when you try to interfere in widget mechanisms.

          1 Reply Last reply
          0
          • the_T Offline
            the_T Offline
            the_
            wrote on last edited by the_
            #5

            Hmm,

            seems to be not the problem of Debug or Release Build.
            In the main.cpp I load a css file to set some styles for the App. This file only exists in Release Build and seems to mess up something.

            Here is the code

            //your code here
            QApplication a(argc, argv);
            
                a.setApplicationName(_APPNAME_);
                a.setApplicationVersion(_APPVERSION_);
                a.setOrganizationName(_ORGNAME_);
                a.setOrganizationDomain(_ORGDOMAIN_);
                QString appname;
                appname = _DISPNAME_;
                appname.append(" v");
                appname.append(_APPVERSION_);
            
                a.setApplicationDisplayName(_DISPNAME_ " v" _APPVERSION_ _SUBVERSION_);
            
            a.setStyle(QStyleFactory::create("Fusion"));
            
            QString css;
             QFile cssfile("main.css");
            if(cssfile.open(QFile::ReadOnly)) {
                    css.append(cssfile.readAll());
                }
            MainWindow w;
            w.setStyleSheet(css);
            w.showMaximized();
            //    w.showNormal();
            //    w.showMaximized();
            
                return a.exec();
            

            //Edit
            I tried the same code on a unix machine, there it works even with the css String set to some stylesheet things
            It does not matter where I write w.setWindowState() as long as css != "" it does not work as expected

            //Edit 2nd
            I ran over the stylesheet again and found out that it seems to be a problem on windows to set

            QWidget { font-size: xxpt;}
            

            -- No support in PM --

            1 Reply Last reply
            0
            • the_T Offline
              the_T Offline
              the_
              wrote on last edited by
              #6

              I think i have solved the problem

              if I try to set the global font size in the main.cpp wit a.setFont() it messes up everything.

              Setting the font in the mainwindow with QApplication::setFont() does well.

              -- No support in PM --

              ? 1 Reply Last reply
              0
              • the_T the_

                I think i have solved the problem

                if I try to set the global font size in the main.cpp wit a.setFont() it messes up everything.

                Setting the font in the mainwindow with QApplication::setFont() does well.

                ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #7

                @the_ Hi! Very strange. Please be so kind and file a bug report. Thank you :-)

                the_T 1 Reply Last reply
                0
                • ? A Former User

                  @the_ Hi! Very strange. Please be so kind and file a bug report. Thank you :-)

                  the_T Offline
                  the_T Offline
                  the_
                  wrote on last edited by
                  #8

                  @Wieland
                  Bugreport is sent and got low priority ;)

                  -- No support in PM --

                  1 Reply Last reply
                  0

                  • Login

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