detailsbutton.cpp 644 Bytes
Newer Older
dt's avatar
dt committed
1
2
3
4
5
6
#include "detailsbutton.h"

using namespace Utils;

DetailsButton::DetailsButton(QWidget *parent)
#ifdef Q_OS_MAC
7
    : QPushButton(parent),
dt's avatar
dt committed
8
#else
9
    : QToolButton(parent),
dt's avatar
dt committed
10
#endif
11
    m_checked(false)
dt's avatar
dt committed
12
13
14
15
16
17
18
{
#ifdef Q_OS_MAC
    setAttribute(Qt::WA_MacSmallSize);
    setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
#else
    setCheckable(true);
#endif
19
20
21
22
23
24
25
26
27
28
29
30
31
    setText(tr("Show Details"));
    connect(this, SIGNAL(clicked()),
            this, SLOT(onClicked()));
}

void DetailsButton::onClicked()
{
    m_checked = !m_checked;
    if (m_checked) {
        setText(tr("Hide Details"));
    } else {
        setText(tr("Show Details"));
    }
dt's avatar
dt committed
32
}