Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. [Solved]Align scrollbar
QtWS25 Last Chance

[Solved]Align scrollbar

Scheduled Pinned Locked Moved 3rd Party Software
7 Posts 3 Posters 3.8k 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.
  • T Offline
    T Offline
    toho71
    wrote on 31 Jan 2012, 10:12 last edited by
    #1

    Is there anyone who can in a simple way explain how I could align a Scrollbar to a QWT Plot widget.
    I have tried with a scrollbar and a scrollarea but nothing works.

    Maybe someone have done this and got a smaller example.

    pls

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on 31 Jan 2012, 10:25 last edited by
      #2

      You can set the QWT plot widget as the widget for a QScrollArea using QScrollArea::setWidget. Note that it is up to you to make sure the plot widget then has the needed size.

      1 Reply Last reply
      0
      • T Offline
        T Offline
        toho71
        wrote on 31 Jan 2012, 10:30 last edited by
        #3

        Yes I tried that but if I set the setWidget(QWtplot)
        the plotter area(Canvas) disappers.

        I'm a very newbee on this so I need some help

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on 31 Jan 2012, 10:32 last edited by
          #4

          Show us the code then.

          1 Reply Last reply
          0
          • T Offline
            T Offline
            toho71
            wrote on 31 Jan 2012, 10:33 last edited by
            #5

            The code where I set Up the plot

            @ ui->qwtPlot->setAxisScale(0,0,310,50);
            ui->qwtPlot->setCanvasBackground(QBrush(Qt::white));

                ui->qwtPlot->setTitle("Power");
                ui->qwtPlot->setAxisMaxMinor(2,0);
            
               //ui->qwtPlot->plotLayout()->setAlignCanvasToScales(true);
            
                ui->qwtPlot->setAxisTitle(0,"[kw]");
                ui->qwtPlot->setAxisTitle(2,"Time [Sec]");
            

            // panner = new QwtPanner(ui->qwtPlot->canvas());
            ui->qwtPlot->canvas()->setPaintAttribute(QwtPlotCanvas::BackingStore,false);

                ui->qwtPlot->canvas()->setBaseSize(490,271);
                scrollArea = new QScrollArea();
                scrollArea->setBackgroundRole(QPalette::Window);
                scrollArea->setWidget(ui->qwtPlot->canvas());
                scrollArea->setAlignment(Qt::AlignBottom);
            

            @

            1 Reply Last reply
            0
            • U Offline
              U Offline
              uwer
              wrote on 2 Feb 2012, 07:22 last edited by
              #6

              Qwt comes with a set of examples. In the realtime example you find a class ScrollZoomer, that adds scrollbars depending on the zoom base and the current zoom rectangle.

              Adopting this class shoudln't be too difficult, but the code above that will never work as it breaks the layout code of QwtPlot and changes the parent/child relation of QwtPlot and its canvas.

              Uwe

              1 Reply Last reply
              0
              • T Offline
                T Offline
                toho71
                wrote on 2 Feb 2012, 12:32 last edited by
                #7

                OK thanks Uwe
                Maybe I can reach my goal if I use the panner in qwt?

                1 Reply Last reply
                0

                5/7

                31 Jan 2012, 10:33

                • Login

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