1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2018 Werner Schweer and others
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License version 2
9 // as published by the Free Software Foundation and appearing in
10 // the file LICENSE.GPL
11 //=============================================================================
12
13 #include "resetButton.h"
14 #include "icons.h"
15
16 namespace Ms {
17
18 //---------------------------------------------------------
19 // ResetButton
20 //---------------------------------------------------------
21
ResetButton(QWidget * parent)22 ResetButton::ResetButton(QWidget* parent)
23 : QWidget(parent)
24 {
25 reset = new QPushButton(this);
26 reset->setToolTip(tr("Reset to style default"));
27 reset->setIcon(*icons[int(Icons::reset_ICON)]);
28 reset->setMinimumSize(QSize(24,24));
29 reset->setMaximumSize(QSize(24,24));
30 reset->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
31 reset->setFlat(true);
32
33 setStyle = new QPushButton(this);
34 setStyle->setText(tr("S", "set as style"));
35 setStyle->setToolTip(tr("Set as style"));
36 setStyle->setMinimumSize(QSize(24,24));
37 setStyle->setMaximumSize(QSize(24,24));
38 setStyle->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
39 setStyle->setFlat(true);
40
41 QHBoxLayout* l = new QHBoxLayout;
42 l->setSpacing(0);
43 l->setContentsMargins(0, 0, 0, 0);
44 l->addWidget(reset, 0, Qt::AlignLeft);
45 l->addWidget(setStyle, 0, Qt::AlignLeft);
46 setLayout(l);
47 setStyle->hide();
48 show();
49
50 connect(reset, SIGNAL(clicked()), SIGNAL(resetClicked()));
51 connect(setStyle, SIGNAL(clicked()), SIGNAL(setStyleClicked()));
52 }
53
54
55 //---------------------------------------------------------
56 // enableSetStyle
57 //---------------------------------------------------------
58
enableSetStyle(bool val)59 void ResetButton::enableSetStyle(bool val)
60 {
61 setStyle->setVisible(val);
62 }
63
64 } // namespace
65
66