Tooltips and fonts stuff.
[qsnippetsmanager.git] / workmodedialog.cpp
blobba44ec85719b154783c7d853d338adb7c164b77e
1 #include "mainwindow.h"
2 #include "workmodedialog.h"
3 #include "ui_workmodedialog.h"
5 WorkModeDialog::WorkModeDialog(QWidget *parent) :
6 QDialog( parent ),
7 m_ui(new Ui::WorkModeDialog),
8 shortcut( this )
10 m_ui->setupUi(this);
11 setWindowFlags( Qt::WindowStaysOnTopHint | Qt::Tool );
13 p = ( MainWindow* )parent;
15 m_ui->treeView->setModel( &p->model );
16 m_ui->treeView->expandAll();
18 connect( m_ui->searchLineEdit, SIGNAL( textChanged( QString ) ),
19 p, SLOT( on_searchLineEdit_textChanged( QString ) ) );
21 shortcut.setKey( QKeySequence( "F5" ) );
23 connect( &shortcut, SIGNAL( activated() ), p, SLOT( on_action_Normal_activated() ) );
25 hideSnippets();
28 WorkModeDialog::~WorkModeDialog()
30 delete m_ui;
33 void WorkModeDialog::changeEvent(QEvent *e)
35 switch (e->type()) {
36 case QEvent::LanguageChange:
37 m_ui->retranslateUi(this);
38 break;
39 default:
40 break;
44 void WorkModeDialog::hideSnippets() {
45 if( !underMouse() ) {
46 m_ui->treeView->hide();
47 this->setFixedHeight( m_ui->searchLineEdit->height() + 4 );
51 void WorkModeDialog::showSnippets() {
52 m_ui->treeView->show();
53 this->setFixedHeight( m_ui->searchLineEdit->height() + 350 );
56 void WorkModeDialog::enterEvent( QEvent* ) {
57 showSnippets();
60 void WorkModeDialog::leaveEvent( QEvent* ) {
61 hideSnippets();