Which signal is emmited if text in QLabel is changed?
Which signal is emmited if text in QLabel is changed?
Qt 5.3 Opensource & Creator 3.1.2
None, because it's not a dynamic property which has tendency to change over time. It's always you who changes it, programmatically.
J-P Nurmi
Well, this is not good since then I and youhave a problem. I have a QFileDialog, which appearance slot is connected to "Browse button...". Once a file is selected, its path and filename are shows in QLabel and now I have to catch this event. Should I use some other class for showing path and filename or how to catch it?
Qt 5.3 Opensource & Creator 3.1.2
Who sets the filename on the label in the first place?
J-P Nurmi
Well, I have a widget (QDialog) which contains:
- QLabel containting path and filename of file
- QPushButton "Browse" that invokes QFileDialog
and once user presses Ok in QFileDialog, the selected file (with path and filename) is transferred to QLabel i mentioned before. Now I need to catch the QLabel text change.
Qt 5.3 Opensource & Creator 3.1.2
Well, QLabel doesn't offer such signal so why don't you make the dialog emit the change? It's the one who knows about the change. Besides, the label is a private component of the dialog. Who is interested of the change anyway? Something inside or outside the dialog?
J-P Nurmi
The settings class subclassed from QSettings is interested in a change, since the filename path and name are saved into ini file.
Last edited by MarkoSan; 28th March 2008 at 09:34.
Qt 5.3 Opensource & Creator 3.1.2
I had a similar problem, but I "solved" it by intercepting the answer of the QFileDialog.
I mean, the dialog has anyway to be called by a function, so the same function could check if the dialog's ok flag is true, in that case emit your signal... well, I did so and it works fine.
--
raccoon29
"La mia vita finirà quando non vedrò più la gente ridere...non necessariamente alle mie battute"
I've done it!
Thanks for your help. So, I've added custom signal, which is emitted after qfiledialog exec() function and it works ok.
Qt 5.3 Opensource & Creator 3.1.2
Glad it worked.
Just a point: with the signal emitted by exec, make that signal emitted even if the dialog get aborted ("Cancel") so, just be aware of this![]()
--
raccoon29
"La mia vita finirà quando non vedrò più la gente ridere...non necessariamente alle mie battute"
Bookmarks