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. Sidebar in QwtLegend
QtWS25 Last Chance

Sidebar in QwtLegend

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 438 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.
  • I Offline
    I Offline
    itzwich
    wrote on last edited by
    #1

    Hallo,

    ich have a QwtPlot and would like to have a QwtLegend which discripe the curves in my Plot.
    If I insert the legend to my plot I get a scrollbar. How kann ich avoid this Scrollbar. I would like to have my legend in one Line without scrollbar.

    f13e2e79-c3e9-40a8-9803-79acca820619-image.png

    My code:
    QwtLegend* legend = new QwtLegend;
    legend->setDefaultItemMode(QwtLegendData::Checkable);
    legend->setFrameStyle(QFrame::Box | QFrame::Sunken);
    QPalette pal = legend->palette();
    pal.setColor(QPalette::Window, Qt::white);
    legend->setPalette(pal);
    legend->setAutoFillBackground(true);
    ui->plot0->insertLegend(legend, QwtPlot::LeftLegend);

    I hope erveryone can help me.

    Pl45m4P 1 Reply Last reply
    0
    • I itzwich

      Hallo,

      ich have a QwtPlot and would like to have a QwtLegend which discripe the curves in my Plot.
      If I insert the legend to my plot I get a scrollbar. How kann ich avoid this Scrollbar. I would like to have my legend in one Line without scrollbar.

      f13e2e79-c3e9-40a8-9803-79acca820619-image.png

      My code:
      QwtLegend* legend = new QwtLegend;
      legend->setDefaultItemMode(QwtLegendData::Checkable);
      legend->setFrameStyle(QFrame::Box | QFrame::Sunken);
      QPalette pal = legend->palette();
      pal.setColor(QPalette::Window, Qt::white);
      legend->setPalette(pal);
      legend->setAutoFillBackground(true);
      ui->plot0->insertLegend(legend, QwtPlot::LeftLegend);

      I hope erveryone can help me.

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by
      #2

      @itzwich said in Sidebar in QwtLegend:

      How kann ich avoid this Scrollbar

      :-)

      What happens when you increase the space the legend can take in your layout? AFAIK the scrollBar only appears when the legend exeeds the available space.


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      0
      • I Offline
        I Offline
        itzwich
        wrote on last edited by
        #3

        How can I increase the space?

        Pl45m4P 1 Reply Last reply
        0
        • I itzwich

          How can I increase the space?

          Pl45m4P Offline
          Pl45m4P Offline
          Pl45m4
          wrote on last edited by
          #4

          @itzwich

          Does the scrollBar always appear? Just realized that the legend it attached to the plot and no separate widget in a layout.
          It seems that it's a known issue. As soon as the legend text is larger than a given size, the scrollBar appears, even if it makes the plot look a bit ugly.

          Maybe this will help:

          • https://www.qtcentre.org/threads/67409-QwtLegend-obscured-by-quot-as-needed-quot-horizontal-scrollbar

          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

          ~E. W. Dijkstra

          1 Reply Last reply
          0
          • I Offline
            I Offline
            itzwich
            wrote on last edited by
            #5

            It works but now it cuts a part of the legend text
            0014c192-cf16-4148-ab29-1755e844aeae-image.png

            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