21 #include <QGridLayout> 23 #include <QListWidget> 25 #include <QFileDialog> 26 #include <QTextStream> 33 : m_default(sl), m_strList(sl), m_docs(docs), m_id(id)
40 QToolBar *toolBar =
new QToolBar;
41 toolBar->setIconSize(QSize(24,24));
44 m_add->setToolTip(tr(
"Add item"));
47 m_del->setToolTip(tr(
"Delete selected item"));
50 m_upd->setToolTip(tr(
"Update selected item"));
52 m_lb =
new QListWidget;
64 m_brFile->setToolTip(tr(
"Browse to a file"));
70 m_brDir->setToolTip(tr(
"Browse to a folder"));
73 QHBoxLayout *rowLayout =
new QHBoxLayout;
74 rowLayout->addWidget(
m_le );
75 rowLayout->addWidget( toolBar );
76 layout->addWidget(
m_lab, row,0 );
77 layout->addLayout( rowLayout, row,1,1,2 );
78 layout->addWidget(
m_lb, row+1,1,1,2 );
99 if (!
m_le->text().isEmpty())
112 if (
m_lb->currentRow()!=-1)
114 int itemIndex =
m_lb->currentRow();
115 delete m_lb->currentItem();
125 if (
m_lb->currentRow()!=-1 && !
m_le->text().isEmpty())
127 m_lb->currentItem()->setText(
m_le->text());
143 m_lab->setEnabled(state);
144 m_le->setEnabled(state);
145 m_add->setEnabled(state);
146 m_del->setEnabled(state);
147 m_upd->setEnabled(state);
148 m_lb->setEnabled(state);
157 QStringList fileNames = QFileDialog::getOpenFileNames();
162 for ( it= fileNames.
begin(); it != fileNames.
end(); ++it )
168 fileName = dir.relativeFilePath(*it);
174 m_lb->addItem(fileName);
187 QString dirName = QFileDialog::getExistingDirectory();
194 dirName = dir.relativeFilePath(dirName);
200 m_lb->addItem(dirName);
205 m_le->setText(dirName);
Traverses directory structures and contents in a platform-independent way.
Iterator append(const T &x)
Iterator insert(Iterator it, const T &x)
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
static QString fromLatin1(const char *, int len=-1)
def connect(nxgraph, k1, k2, p1=0, p2=0, kwds)
The QTextStream class provides basic functions for reading and writing text using a QIODevice...
void writeStringValue(QTextStream &t, QTextCodec *codec, const QString &s)
Provides conversion between text encodings.
The QFileInfo class provides system-independent file information.
static MainWindow & instance()
virtual bool exists() const
QTextStream & endl(QTextStream &s)