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. QLabel snap to ScrollBar
Qt 6.11 is out! See what's new in the release blog

QLabel snap to ScrollBar

Scheduled Pinned Locked Moved Solved General and Desktop
47 Posts 4 Posters 9.5k 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.
  • M Offline
    M Offline
    Mikeeeeee
    wrote on last edited by Mikeeeeee
    #31

    How do I know the visible coordinates of an Image?

    jsulmJ 1 Reply Last reply
    0
    • M Mikeeeeee

      How do I know the visible coordinates of an Image?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #32

      @Mikeeeeee said in QLabel snap to ScrollBar:

      How do I know the visible coordinates of an Image?

      What do you mean?
      What are "visible coordinates" and relative to what do you want to have them?
      Do you mean you want to know which part of displayed image is visible?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • M Offline
        M Offline
        Mikeeeeee
        wrote on last edited by Mikeeeeee
        #33

        Yes. For example, I see the Central 50% of the image? How do I know I'm seeing an image from 25% to 75%?

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Mikeeeeee
          wrote on last edited by Mikeeeeee
          #34

          Partially solve. But regardless of the scrollbar state, pageStep() returns a single value

          qDebug()<<scrollArea->horizontalScrollBar()->value()
          <<scrollArea->horizontalScrollBar()->maximum()
          <<scrollArea->horizontalScrollBar()->minimum()
          <<scrollArea->horizontalScrollBar()->pageStep();
          
          1 Reply Last reply
          0
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #35

            @Mikeeeeee said in QLabel snap to ScrollBar:

            pageStep

            But it is a single step value. how much to scroll for a page.
            What do you need it for ?

            1 Reply Last reply
            0
            • M Offline
              M Offline
              Mikeeeeee
              wrote on last edited by
              #36

              I wanted to know the width of the scroll and scrollbar and calculate the visible part.

              1 Reply Last reply
              0
              • M Offline
                M Offline
                Mikeeeeee
                wrote on last edited by Mikeeeeee
                #37

                Need to know the size of the scroll and its position and determine.
                Scroll size = (widget size/picture size)/zoom

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  Mikeeeeee
                  wrote on last edited by
                  #38

                  How can I remove the menu bar? If I remove createActions(); from the constructor, the program does not start.

                  1 Reply Last reply
                  0
                  • mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #39

                    Hi
                    If i do
                    // createActions();
                    it starts fine.
                    Please provide more details.

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      Mikeeeeee
                      wrote on last edited by
                      #40

                      The compiler writes that the program closed abnormally. Debagger says he received a signal from the operating system: SIGSEGV , destination: Segmentation fault

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        Mikeeeeee
                        wrote on last edited by
                        #41

                        If you want, I can send you the project

                        1 Reply Last reply
                        0
                        • mrjjM Offline
                          mrjjM Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on last edited by
                          #42

                          hi
                          I think its something else than createActions();
                          Use the debugger to find the line where it crashes.

                          1 Reply Last reply
                          0
                          • M Offline
                            M Offline
                            Mikeeeeee
                            wrote on last edited by
                            #43

                            error in qaction.cpp

                            void QAction::setEnabled(bool b)
                            {
                                Q_D(QAction);
                                if (b == d->enabled && b != d->forceDisabled)
                                    return;
                                d->forceDisabled = !b;
                                if (b && (!d->visible || (d->group && !d->group->isEnabled())))
                                    return;
                                QAPP_CHECK("setEnabled");
                                d->enabled = b;
                            #ifndef QT_NO_SHORTCUT
                                d->setShortcutEnabled(b, qApp->d_func()->shortcutMap);  //here
                            #endif
                                d->sendDataChanged();
                            }
                            
                            1 Reply Last reply
                            0
                            • M Offline
                              M Offline
                              Mikeeeeee
                              wrote on last edited by
                              #44
                              This post is deleted!
                              1 Reply Last reply
                              0
                              • M Offline
                                M Offline
                                Mikeeeeee
                                wrote on last edited by Mikeeeeee
                                #45

                                I commented out all QAction and the program starts, but the picture at start is not loaded. But you need to change the zoom level to display the picture. Please tell me how to fix it.

                                mrjjM 1 Reply Last reply
                                0
                                • M Mikeeeeee

                                  I commented out all QAction and the program starts, but the picture at start is not loaded. But you need to change the zoom level to display the picture. Please tell me how to fix it.

                                  mrjjM Offline
                                  mrjjM Offline
                                  mrjj
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #46

                                  @Mikeeeeee

                                  hi
                                  I think it would be better to call
                                  createActions();
                                  and simply do

                                  menuBar()->hide();

                                  so its not shown.

                                  That way you dont get issues with dangling pointers in the program.

                                  1 Reply Last reply
                                  1
                                  • M Offline
                                    M Offline
                                    Mikeeeeee
                                    wrote on last edited by
                                    #47

                                    @mrjj said in QLabel snap to ScrollBar:

                                    menuBar()->hide();

                                    it works, thank you!

                                    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