;o)) i meant myStrList.....
so I have some code:
dock->setFont(font);
//set the color of the dockwidget
dock->setAutoFillBackground(true);
dock
->setBackgroundRole
(QPalette::Window);
dock->setPalette(qpal);
//end set color
dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
foreach
(QString str, myStringList
) { customerList->addItem(item);
}
dock->setWidget(customerList);
addDockWidget(Qt::LeftDockWidgetArea, dock);
viewMenu->addAction(dock->toggleViewAction());
QDockWidget *dock = new QDockWidget(tr("Verwaltung"), this);
QFont font("Verdana", 10, QFont::Bold);
dock->setFont(font);
//set the color of the dockwidget
dock->setAutoFillBackground(true);
QPalette qpal;
qpal.setColor(QPalette::Active,QPalette::Window,QColor(210,239,109));
dock->setBackgroundRole(QPalette::Window);
dock->setPalette(qpal);
//end set color
dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
customerList = new QListWidget(dock);
QStringList myStringList("hallo","servus");
QIcon *icon=new QIcon(":/images/labelic1.ico");
foreach(QString str, myStringList) {
QListWidgetItem *item = new QListWidgetItem(icon, str, customerList);
customerList->addItem(item);
}
dock->setWidget(customerList);
addDockWidget(Qt::LeftDockWidgetArea, dock);
viewMenu->addAction(dock->toggleViewAction());
To copy to clipboard, switch view to plain text mode
But iI get some Errors like this:
mainwindow.cpp: In member function `void MainWindow::createDockWindows()':
mainwindow.cpp:160: error: no matching function for call to `QStringList::QStringList(const char[6], const char[7])'
c
:/Qt
/4.3.1
/include
/QtCore
/..
/..
/src
/corelib
/tools
/qstringlist.
h:67: note
: candidates are
: QStringList::QStringList(const QList<QString>
&)c
:/Qt
/4.3.1
/include
/QtCore
/..
/..
/src
/corelib
/tools
/qstringlist.
h:66: note
: QStringList::QStringList(const QStringList
&)c
:/Qt
/4.3.1
/include
/QtCore
/..
/..
/src
/corelib
/tools
/qstringlist.
h:65: note
: QStringList::QStringList(const QString
&)c:/Qt/4.3.1/include/QtGui/../../src/gui/itemviews/qlistwidget.h:67: note: candidates are: QListWidgetItem::QListWidgetItem(const QListWidgetItem&)
c:/Qt/4.3.1/include/QtGui/../../src/gui/itemviews/qlistwidget.h:66: note: QListWidgetItem::QListWidgetItem(const QIcon&, const QString&, QListWidget*, int)
c:/Qt/4.3.1/include/QtGui/../../src/gui/itemviews/qlistwidget.h:64: note: QListWidgetItem::QListWidgetItem(const QString&, QListWidget*, int)
c:/Qt/4.3.1/include/QtGui/../../src/gui/itemviews/qlistwidget.h:63: note: QListWidgetItem::QListWidgetItem(QListWidget*, int)
mingw32-make[1]: *** [release\mainwindow.o] Error 1
mingw32-make: *** [release] Error 2
mingw32-make[1]: Leaving directory `J:/qtprojects/Modest-Office'
---------------------- Build finished with 4 error(s) and 3 warning(s) ----------------------
mainwindow.cpp: In member function `void MainWindow::createDockWindows()':
mainwindow.cpp:160: error: no matching function for call to `QStringList::QStringList(const char[6], const char[7])'
c:/Qt/4.3.1/include/QtCore/../../src/corelib/tools/qstringlist.h:67: note: candidates are: QStringList::QStringList(const QList<QString>&)
c:/Qt/4.3.1/include/QtCore/../../src/corelib/tools/qstringlist.h:66: note: QStringList::QStringList(const QStringList&)
c:/Qt/4.3.1/include/QtCore/../../src/corelib/tools/qstringlist.h:65: note: QStringList::QStringList(const QString&)
c:/Qt/4.3.1/include/QtCore/../../src/corelib/tools/qstringlist.h:64: note: QStringList::QStringList()
mainwindow.cpp:163: error: no matching function for call to `QListWidgetItem::QListWidgetItem(QIcon*&, QString&, QListWidget*&)'
c:/Qt/4.3.1/include/QtGui/../../src/gui/itemviews/qlistwidget.h:67: note: candidates are: QListWidgetItem::QListWidgetItem(const QListWidgetItem&)
c:/Qt/4.3.1/include/QtGui/../../src/gui/itemviews/qlistwidget.h:66: note: QListWidgetItem::QListWidgetItem(const QIcon&, const QString&, QListWidget*, int)
c:/Qt/4.3.1/include/QtGui/../../src/gui/itemviews/qlistwidget.h:64: note: QListWidgetItem::QListWidgetItem(const QString&, QListWidget*, int)
c:/Qt/4.3.1/include/QtGui/../../src/gui/itemviews/qlistwidget.h:63: note: QListWidgetItem::QListWidgetItem(QListWidget*, int)
mingw32-make[1]: *** [release\mainwindow.o] Error 1
mingw32-make: *** [release] Error 2
mingw32-make[1]: Leaving directory `J:/qtprojects/Modest-Office'
---------------------- Build finished with 4 error(s) and 3 warning(s) ----------------------
To copy to clipboard, switch view to plain text mode
Bookmarks