7 changed files with 357 additions and 12 deletions
@ -0,0 +1,46 @@
@@ -0,0 +1,46 @@
|
||||
#include "UASQuickViewItemSelect.h" |
||||
#include <QLabel> |
||||
#include <QCheckBox> |
||||
UASQuickViewItemSelect::UASQuickViewItemSelect(QWidget *parent) : QWidget(parent) |
||||
{ |
||||
ui.setupUi(this); |
||||
currcol = 0; |
||||
currrow = 0; |
||||
} |
||||
void UASQuickViewItemSelect::addItem(QString item,bool enabled) |
||||
{ |
||||
QCheckBox *label = new QCheckBox(this); |
||||
if (enabled) |
||||
{ |
||||
label->setChecked(true); |
||||
} |
||||
connect(label,SIGNAL(clicked(bool)),this,SLOT(checkBoxClicked(bool))); |
||||
label->setText(item); |
||||
label->show(); |
||||
ui.gridLayout->addWidget(label,currrow,currcol++); |
||||
if (currcol > 10) |
||||
{ |
||||
currcol = 0; |
||||
currrow++; |
||||
} |
||||
} |
||||
void UASQuickViewItemSelect::checkBoxClicked(bool checked) |
||||
{ |
||||
QCheckBox *check = qobject_cast<QCheckBox*>(sender()); |
||||
if (!check) |
||||
{ |
||||
return; |
||||
} |
||||
if (checked) |
||||
{ |
||||
emit valueEnabled(check->text()); |
||||
} |
||||
else |
||||
{ |
||||
emit valueDisabled(check->text()); |
||||
} |
||||
} |
||||
|
||||
UASQuickViewItemSelect::~UASQuickViewItemSelect() |
||||
{ |
||||
} |
@ -0,0 +1,26 @@
@@ -0,0 +1,26 @@
|
||||
#ifndef UASQUICKVIEWITEMSELECT_H |
||||
#define UASQUICKVIEWITEMSELECT_H |
||||
|
||||
#include <QWidget> |
||||
#include "ui_UASQuickViewItemSelect.h" |
||||
|
||||
class UASQuickViewItemSelect : public QWidget |
||||
{ |
||||
Q_OBJECT |
||||
|
||||
public: |
||||
explicit UASQuickViewItemSelect(QWidget *parent = 0); |
||||
~UASQuickViewItemSelect(); |
||||
void addItem(QString item,bool enabled = false); |
||||
int currrow; |
||||
int currcol; |
||||
private: |
||||
Ui::UASQuickViewItemSelect ui; |
||||
private slots: |
||||
void checkBoxClicked(bool checked); |
||||
signals: |
||||
void valueEnabled(QString value); |
||||
void valueDisabled(QString value); |
||||
}; |
||||
|
||||
#endif // UASQUICKVIEWITEMSELECT_H
|
@ -0,0 +1,73 @@
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<ui version="4.0"> |
||||
<class>UASQuickViewItemSelect</class> |
||||
<widget class="QWidget" name="UASQuickViewItemSelect"> |
||||
<property name="geometry"> |
||||
<rect> |
||||
<x>0</x> |
||||
<y>0</y> |
||||
<width>571</width> |
||||
<height>474</height> |
||||
</rect> |
||||
</property> |
||||
<property name="windowTitle"> |
||||
<string>Form</string> |
||||
</property> |
||||
<widget class="QPushButton" name="pushButton"> |
||||
<property name="geometry"> |
||||
<rect> |
||||
<x>30</x> |
||||
<y>410</y> |
||||
<width>75</width> |
||||
<height>23</height> |
||||
</rect> |
||||
</property> |
||||
<property name="text"> |
||||
<string>PushButton</string> |
||||
</property> |
||||
</widget> |
||||
<widget class="QPushButton" name="pushButton_2"> |
||||
<property name="geometry"> |
||||
<rect> |
||||
<x>230</x> |
||||
<y>410</y> |
||||
<width>75</width> |
||||
<height>23</height> |
||||
</rect> |
||||
</property> |
||||
<property name="text"> |
||||
<string>PushButton</string> |
||||
</property> |
||||
</widget> |
||||
<widget class="QScrollArea" name="scrollArea"> |
||||
<property name="geometry"> |
||||
<rect> |
||||
<x>10</x> |
||||
<y>10</y> |
||||
<width>531</width> |
||||
<height>321</height> |
||||
</rect> |
||||
</property> |
||||
<property name="widgetResizable"> |
||||
<bool>true</bool> |
||||
</property> |
||||
<widget class="QWidget" name="scrollAreaWidgetContents"> |
||||
<property name="geometry"> |
||||
<rect> |
||||
<x>0</x> |
||||
<y>0</y> |
||||
<width>529</width> |
||||
<height>319</height> |
||||
</rect> |
||||
</property> |
||||
<layout class="QHBoxLayout" name="horizontalLayout"> |
||||
<item> |
||||
<layout class="QGridLayout" name="gridLayout"/> |
||||
</item> |
||||
</layout> |
||||
</widget> |
||||
</widget> |
||||
</widget> |
||||
<resources/> |
||||
<connections/> |
||||
</ui> |
Loading…
Reference in new issue