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. how do i resize the Qwt plot when i am resizing the Qwidget
QtWS25 Last Chance

how do i resize the Qwt plot when i am resizing the Qwidget

Scheduled Pinned Locked Moved Unsolved 3rd Party Software
2 Posts 2 Posters 978 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.
  • S Offline
    S Offline
    sravani
    wrote on 11 Sept 2020, 10:12 last edited by
    #1

    I have applayed resizeevent to QWidget if, i am trying to resize the widget inside a widget QWT plot is there that should also resize. I have applayed resizeevent to the QWidget and resize to the plot.

    i have written bellow code
    void SampleWidget:: resizeEvent(QResizeEvent* event)
    {
    QWidget::resizeEvent(event);

     int diffofWidth = event->size().width() - event->oldSize().width();     
     int diffofHeight = event->size().height() - event->oldSize().height();
     QSize size = plot->size();
    
     if ((event->oldSize().width() >= 0) && (event->oldSize().height() >= 0))
     {
         if (event->size().width() <= this->minimumWidth() && event->size().height() <= this->minimumHeight())
        {
            return;
        }
        else
        {
            plot->resize(size.width() + diffofWidth, size.height() + diffofHeight);
            plot->replot();
        }
     }
    

    }
    I have written this above code widget is able to resize after so many times resize performed to the widget.plot is displayed partial in the widget. i am not able to see whole content in the widget. i have set the minimumsize( 400, 400) of the widget to restrict the minimum size for the widget beyond that limit widget should not minimize. but it's not working.

    Could you please any one guide me to solve my issue.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 11 Sept 2020, 18:46 last edited by
      #2

      Hi and welcome to devnet,

      Why not use a layout for that ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1

      2/2

      11 Sept 2020, 18:46

      • Login

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