Resizing QFrame and a paradox



  • Dear all,

    I want to user can't maximum and minimum with mouse, my QFrame, and my scenrario:
    I have a QTableWidget in my QFrame , i disbable QTableWidget via "setVisible(False)" i want to when user checked an checkbox, my QFrame resize and bigger and show my QTableWidget with "setVisible(True)" , I didn't any problem with visibility, but i have problem with the following paradox:

    How i combine resizing QFrame, and disable my Qframe for mouse and keyboard?

    --mohsen


  • Moderators

    since it works as expected when the widget is visible i assume you use layouts. Which control then the minimum size.
    You have the following possibilities:

    set the minimum size of the QFrame to the minimum sizehint of the QTableWidget

    or use the following code to add the widget to your layout:
    @
    class MyWidgetLayoutItem : public QWidgetItem
    {
    public:
    MyWidgetLayoutItem( QWidget * widget )
    : QWidgetItem(widget)
    {
    }

    virtual bool isEmpty () const
    {
        return false; //ensure this layoutitem is still taken into account even when the widget is hidden
    }
    

    };
    @

    and add it to the layout like this:
    @
    layout->addItem( new MyWidgetLayoutItem(tableWidget) );
    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.