PDA

View Full Version : QToolBox and signal



mattia
27th December 2007, 07:10
Hello, i have a problem with QToolBox.
I read the QToolBox can contain some tabs and they are QWidget's items.
When i select a page(tab) the signal currentChanged() is emitted, but when i jump in the slot connected to currentChanged() the page is already changed, i'd like to do some control before to change the page and i have not found any signal to do this.
Is there a signal called before currentChanged() at the page rise?

jpn
27th December 2007, 07:35
Unfortunately, there doesn't seem to be any method for that. You can send a feature request at Task-Tracker.

mattia
27th December 2007, 07:40
Ok, i'll do it, do you know any work-around to performe this?

jpn
27th December 2007, 08:20
What would you like to do? You could for example reimplement QWidget::setVisible() of page widgets.

mattia
27th December 2007, 08:49
When i click on a QWidgets in my QToolBox i want to check some parameter befor to load/rise the QWidget clicked, if the parameter checked is true i'd like to load/rise the QWidget clicked otherwise i want to stay on my old QWidget.
This is the behavoir that i want to get.

jpn
27th December 2007, 08:55
Sorry, I don't understand the problem. Could you rephrase, please? Pay special attention to terms "click" and "check". Remember that we don't know what do the page widgets look like. When "clicking widgets" and "checking widgets" do you mean changing the current item of the tool box?

mattia
27th December 2007, 09:35
When i click on a QWidgets in my QToolBox i want to check some parameter befor to load/rise the QWidget clicked, if the parameter checked is true i'd like to load/rise the QWidget clicked otherwise i want to stay on my old QWidget.
This is the behavoir that i want to get.
click = action that allow to change the current item of the tool box
check = action that i want to perform before the "click"
load/rise = the result of "click" action

thx for your patience

mattia
27th December 2007, 15:57
Maybe i can reimplement "event ( QEvent * event )" and check when the mouse is clicked on my QToolBox, is it possibile?

wysota
27th December 2007, 16:45
The simplest solution is to revert back to the previous widget if the check fails after the new widget has been shown from within the slot mentioned in the first post of this thread. There shouldn't even be any flicker as you'll be doing it before events are processed.