blob: af22b80e5232a6b65321f3218c0462f973feac2b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#include <QtGui>
#include "encodewidget.h"
EncodeWidget::EncodeWidget(QWidget *parent)
: QWidget(parent)
{
setupUi(this);
convertButton->setDisabled( true );
connect(convertButton, SIGNAL(clicked()), this, SIGNAL(convert()));
}
void EncodeWidget::setModel( QStandardItemModel *m )
{
titleTree->setModel( m );
titleTree->setSelectionMode( QAbstractItemView::NoSelection );
titleTree->setRootIsDecorated( false );
titleTree->setFocusPolicy( Qt::NoFocus );
connect(titleTree->model(), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), SLOT(changed()));
}
void EncodeWidget::changed()
{
bool enable = false;
for( int row = 0; row < titleTree->model()->rowCount(); ++row )
{
QStandardItem *si = qobject_cast<QStandardItemModel *>(titleTree->model())->item( row, 0 );
if( si->checkState() == Qt::Checked )
{
enable = true;
}
}
convertButton->setEnabled( enable );
}
|