KDE TechBase
  • Page
  • Discussion
  • Edit
  • History
KDE TechBase is a Wiki - You can help! Please contribute! Questions?
Please ask development related questions in the KDE Community Forum.

Development/Tutorials/Programming Tutorial KDE 4/Using QTreeWidget

< Development | Tutorials | Programming Tutorial KDE 4
Revision as of 14:20, 28 June 2007 by Milliams (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Warning
noframe
This page has been nominated for speedy deletion. This delay is intended to give the contributor time to modify the page to make it relevant. If it is relevant, please remove this tag.

If you disagree with its speedy deletion, remove the template and discuss it on its talk page.

Administrators: Please check the page history, especially the last diff, and What links here before deleting.


[edit] Code it

main.cpp

#include <kapplication.h>
#include <kaboutdata.h>
#include <kcmdlineargs.h>
#include <QTableWidget>
#include <QTreeWidget>
#include <QHeaderView>
 
int main (int argc, char *argv[])
{
KAboutData aboutData( "test", "test",
"1.0", "test", KAboutData::License_GPL,
"(c) 2007" );
KCmdLineArgs::init( argc, argv, &aboutData );
KApplication khello;
 
QTreeWidget* mw=new QTreeWidget(0);
 
QStringList labels;
mw->setColumnCount(2);
mw->setEditTriggers(QAbstractItemView::AllEditTriggers);
QTreeWidgetItem* item=new QTreeWidgetItem(0);
item->setText(1,"hi");
item->setFlags(Qt::ItemIsEnabled);
mw->insertTopLevelItem(0,item);
mw->show();
khello.exec();
}

CMakeLists.txt

PROJECT( ktreewidget )
FIND_PACKAGE(KDE4 REQUIRED)
INCLUDE_DIRECTORIES( ${KDE4_INCLUDES} . )
 
 
SET(ktreewidgetsources main.cpp )
 
KDE4_ADD_EXECUTABLE(ktreewidget ${ktreewidgetsources} )
 
TARGET_LINK_LIBRARIES(ktreewidget ${KDE4_KDEUI_LIBS} ${KDE4_KPARTS_LIBS} )

[edit] Kompile it

cmake . -DCMAKE_INSTALL_PREFIX=$KDEDIR -DCMAKE_BUILD_TYPE=debugfull && make -j2 VERBOSE=1

[edit] Run it

./ktreewidget
Retrieved from "http://techbase.kde.org/Development/Tutorials/Programming_Tutorial_KDE_4/Using_QTreeWidget"
Category: Marked for Deletion

Navigation

  • Home
  • Help
  • Recent changes

Sections

  • Getting started
  • Development
  • Schedules
  • Policies
  • Contribute
  • Projects

Toolbox

  • What links here
  • Related changes
  • Special pages
  • Printable version
  • Permanent link

Personal tools

  • 38.107.191.98
  • Talk for this IP
  • Log in / create account
  • Login with OpenID
Creative Commons License SA 3.0 as well as the GNU Free Documentation License 1.2
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal