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. Move a QLabel through a QGridLayout

Move a QLabel through a QGridLayout

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 1.7k 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.
  • ivanicyI Offline
    ivanicyI Offline
    ivanicy
    wrote on last edited by ivanicy
    #1

    Hello!

    I am making an app that includes a doubleSlider. Under it, I have to QLabels that show the slider handler values. That I want to do is move this labels to the handlers position, like it shown in the images:

    That I have:
    0_1510226725301_07ef332c-d9c6-4b2f-a63b-66b2b1c4bfb1-imagen.png

    That I want:
    0_1510226817086_c988e3f4-2039-4614-9a04-79355806038f-imagen.png

    I have connected the valuesChanged(double, double) signal to this slot, but it doesn't work. The QLabels are in a QGridLayout:

    void settings::updateValues(double valueMin, double valueMax)
    {
        ui->minBeep->setText(QString::number(valueMin, 'f', 0));
        ui->maxBeep->setText(QString::number(valueMax+1, 'f', 0));
    
        double posMin, posMax;
        posMin = ((m_pSliderDoble->geometry().width() * valueMin) / m_pSliderDoble->maximumValue());
        posMax = ((m_pSliderDoble->geometry().width() * valueMax) / m_pSliderDoble->minimumValue());
    
        ui->minBeep->move(posMin, 0);
        ui->maxBeep->move(posMax, 0);
    }
    

    Any help with it?

    Thank you very much!

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

      Hi
      You cannot use move when they are controlled by a layout.

      ivanicyI 1 Reply Last reply
      1
      • mrjjM mrjj

        Hi
        You cannot use move when they are controlled by a layout.

        ivanicyI Offline
        ivanicyI Offline
        ivanicy
        wrote on last edited by
        #3

        @mrjj And.. Is there any other way to do it?

        mrjjM 1 Reply Last reply
        0
        • ivanicyI ivanicy

          @mrjj And.. Is there any other way to do it?

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

          @ivanicy
          Dont use a layout / put the labels in the layout ?
          Or paint the values with the handles ?

          ps. Nice double slider :)
          Is it a custom control ?

          ivanicyI 1 Reply Last reply
          2
          • mrjjM mrjj

            @ivanicy
            Dont use a layout / put the labels in the layout ?
            Or paint the values with the handles ?

            ps. Nice double slider :)
            Is it a custom control ?

            ivanicyI Offline
            ivanicyI Offline
            ivanicy
            wrote on last edited by
            #5

            @mrjj In this list you can find the doubleSlider classes:
            ctkDoubleRangeSlider.cpp
            ctkDoubleSlider.cpp
            ctkRangeSlider.cpp
            https://github.com/commontk/CTK/tree/master/Libs/Widgets

            And this other:
            ctkValueProxy.cpp
            https://github.com/commontk/CTK/tree/master/Libs/Core

            mrjjM 1 Reply Last reply
            2
            • ivanicyI ivanicy

              @mrjj In this list you can find the doubleSlider classes:
              ctkDoubleRangeSlider.cpp
              ctkDoubleSlider.cpp
              ctkRangeSlider.cpp
              https://github.com/commontk/CTK/tree/master/Libs/Widgets

              And this other:
              ctkValueProxy.cpp
              https://github.com/commontk/CTK/tree/master/Libs/Core

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

              @ivanicy

              Ok, seems like nice collection.

              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