Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QLabel showFullScreen not working correctly
Forum Updated to NodeBB v4.3 + New Features

QLabel showFullScreen not working correctly

Scheduled Pinned Locked Moved Mobile and Embedded
10 Posts 5 Posters 12.8k Views 1 Watching
  • 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.
  • F Offline
    F Offline
    franklovecchio
    wrote on last edited by
    #1

    I have an image that I display, and I'm trying to resize to fullscreen dynamically. The problem is that showFullScreen doesn't work by itself; I have to set a QSize (and this is definitely not the correct way). What am I doing wrong?

    @QImage image("c://default.png");

    QLabel* imageLabel = new QLabel(this);
    imageLabel->setPixmap(QPixmap::fromImage(image));
    imageLabel->setAlignment(Qt::AlignCenter);
    //resize to fullscreen dynamically by device?
    imageLabel->resize(QSize(350, 600));
    //doesn't work on it's own
    imageLabel->showFullScreen();@

    1 Reply Last reply
    0
    • B Offline
      B Offline
      blex
      wrote on last edited by
      #2

      From the Qt doc:

      @
      void QWidget::showFullScreen ()

      Calling this function only affects windows.
      @

      @
      bool QWidget::isWindow () const

      Returns true if the widget is an independent window, otherwise returns false.
      @

      Is your widget independent window?


      Oleksiy Balabay

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tobias.hunger
        wrote on last edited by
        #3

        showFullScreen will not break the layout: What is the size policy of your widget? What are is the maximum size of it?

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DenisKormalev
          wrote on last edited by
          #4

          tamhanna, not everythin that works is correct. Author just trying to find correct way to do things.

          1 Reply Last reply
          0
          • ? This user is from outside of this forum
            ? This user is from outside of this forum
            Guest
            wrote on last edited by
            #5

            [quote author="Tobias Hunger" date="1290932386"]showFullScreen will not break the layout: What is the size policy of your widget? What are is the maximum size of it?
            [/quote]

            yes check if you set any fixed size policy
            also set the windowtype and windowflags to make it a top level window, then you should be able to show it full screen
            also note the platform limitations as mentioned in the docs

            1 Reply Last reply
            0
            • ? This user is from outside of this forum
              ? This user is from outside of this forum
              Guest
              wrote on last edited by
              #6

              [quote author="tamhanna" date="1291465736"]Not trying to offend.

              Just trying to tell him to move on. You cannot always find perfect solution![/quote]

              the author knows that showing full screen by using size is flawed and is seeking a better solution. we are engineers and lets find a better way to do it. lets not forget quality.

              also request you to post an answer only if you know the answer. else some other user who knows the answer, or who can provide good hints will pitch in. we are all here to learn and help each other.

              thanks!

              1 Reply Last reply
              0
              • X Offline
                X Offline
                xsacha
                wrote on last edited by
                #7

                chetankjain, ignore tamhanna - he's just spamming and if you reply you give him a reason to reply again with 'yes' or 'i agree' or some other meaningless message.

                The platform isn't mentioned which could affect how showFullScreen works. The size of 350x600 seems suspicious for fullscreen. Not a desktop?

                Also, is there any main window code? Or is this widget the window?

                • Sacha
                1 Reply Last reply
                0
                • ? This user is from outside of this forum
                  ? This user is from outside of this forum
                  Guest
                  wrote on last edited by
                  #8

                  here goes:

                  @
                  label->setWindowFlags(Qt::Window);
                  label->setScaledContents(true);
                  label->showFullScreen();
                  @

                  no hardcoding

                  1 Reply Last reply
                  0
                  • X Offline
                    X Offline
                    xsacha
                    wrote on last edited by
                    #9

                    Remember that changing it to a Qt::Window will move it to the origin (0,0) relative to parent windows/desktop. It's just using setParent().

                    Shouldn't affect fullscreening. But maybe if you get out of fullscreen after.

                    You could use a maximise hint with a frameless border as an alternative to fullscreen as well.

                    http://doc.trolltech.com/latest/widgets-windowflags.html

                    • Sacha
                    1 Reply Last reply
                    0
                    • F Offline
                      F Offline
                      franklovecchio
                      wrote on last edited by
                      #10

                      I set the parent Widget to showFullscreen and did a sizeHint on the imageLabel. It was the parent's fault. (It's not a desktop, but rather a mobile app)

                      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