Mercurial > hg > easyhg
comparison src/findwidget.cpp @ 556:04f18b2a32e8 find
Add forgotten files. So busy looking at the test search results, I totally forget to read what the program is actually telling me!
author | Chris Cannam |
---|---|
date | Thu, 23 Feb 2012 11:44:50 +0000 |
parents | |
children | 57a7f95ef400 |
comparison
equal
deleted
inserted
replaced
555:a1d210c767ab | 556:04f18b2a32e8 |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* | |
4 EasyMercurial | |
5 | |
6 Based on HgExplorer by Jari Korhonen | |
7 Copyright (c) 2010 Jari Korhonen | |
8 Copyright (c) 2011 Chris Cannam | |
9 Copyright (c) 2011 Queen Mary, University of London | |
10 | |
11 This program is free software; you can redistribute it and/or | |
12 modify it under the terms of the GNU General Public License as | |
13 published by the Free Software Foundation; either version 2 of the | |
14 License, or (at your option) any later version. See the file | |
15 COPYING included with this distribution for more information. | |
16 */ | |
17 | |
18 #include "findwidget.h" | |
19 | |
20 #include <QGridLayout> | |
21 #include <QLabel> | |
22 #include <QLineEdit> | |
23 #include <QToolButton> | |
24 | |
25 FindWidget::FindWidget(QWidget *parent) : | |
26 QWidget(parent) | |
27 { | |
28 QGridLayout *layout = new QGridLayout; | |
29 setLayout(layout); | |
30 | |
31 QToolButton *button = new QToolButton(); | |
32 layout->addWidget(button, 0, 0); | |
33 button->setText(tr("Find...")); | |
34 button->setToolButtonStyle(Qt::ToolButtonTextOnly); | |
35 button->setAutoRaise(true); | |
36 connect(button, SIGNAL(clicked()), this, SLOT(buttonPressed())); | |
37 | |
38 /* | |
39 QLabel *label = new QLabel(tr("Find:")); | |
40 layout->addWidget(label, 0, 0); | |
41 */ | |
42 m_lineEdit = new QLineEdit(); | |
43 layout->addWidget(m_lineEdit, 0, 1); | |
44 | |
45 m_lineEdit->setFixedWidth(100); | |
46 m_lineEdit->hide(); | |
47 | |
48 connect(m_lineEdit, SIGNAL(textChanged(const QString &)), | |
49 this, SIGNAL(findTextChanged(QString))); | |
50 } | |
51 | |
52 FindWidget::~FindWidget() | |
53 { | |
54 } | |
55 | |
56 void | |
57 FindWidget::buttonPressed() | |
58 { | |
59 QAbstractButton *button = qobject_cast<QAbstractButton *>(sender()); | |
60 if (!button) return; | |
61 if (m_lineEdit->isVisible()) { | |
62 m_lineEdit->hide(); | |
63 button->setText(tr("Find...")); | |
64 } else { | |
65 m_lineEdit->show(); | |
66 button->setText(tr("Find:")); | |
67 } | |
68 } | |
69 |