Changeset 9 in tspsg-svn for trunk


Ignore:
Timestamp:
Oct 15, 2007, 8:46:46 PM (17 years ago)
Author:
laleppa
Message:

Displaying status tips of Settings dialog elements in its hint label

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        99qrc_*
        1010tspsg
        11 Makefile
         11Makefile*
        1212debug
        1313release
  • trunk/src/main.cpp

    r6 r9  
    2626#include <QMessageBox>
    2727#include "mainwindow.h"
     28
    2829int main(int argc, char *argv[])
    2930{
  • trunk/src/settingsdialog.cpp

    r6 r9  
    2222 */
    2323
     24#include <QMessageBox>
     25#include <QStatusTipEvent>
    2426#include "settingsdialog.h"
    25 #include <QMessageBox>
    2627
    2728SettingsDialog::SettingsDialog(QWidget *parent)
     
    3536        setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
    3637        layout()->setSizeConstraint(layout()->SetFixedSize);
     38        // Setting initial text of dialog hint label to own status tip text
     39        labelHint->setText(labelHint->statusTip());
    3740}
    3841
     42bool SettingsDialog::event(QEvent *ev)
     43{
     44        // Checking for StatusTip event and if tip text is not empty string
     45        // setting it as text of the dialog hint label. Otherwise, setting
     46        // dialog hint label text to own status tip text
     47        if (ev->type() == QEvent::StatusTip) {
     48QString tip = static_cast<QStatusTipEvent *>(ev)->tip();
     49                if (tip.length() != 0)
     50                        labelHint->setText(tip);
     51                else
     52                        labelHint->setText(labelHint->statusTip());
     53                return true;
     54        } else
     55                return QDialog::event(ev);
     56}
     57
  • trunk/src/settingsdialog.h

    r6 r9  
    3333public:
    3434        SettingsDialog(QWidget *parent = 0);
    35        
     35
     36private:
     37        bool event(QEvent *);
     38
    3639private slots:
    3740        void spinRandMinValueChanged(int val) { spinRandMax->setMinimum(val + 1); }
Note: See TracChangeset for help on using the changeset viewer.