
Untitled
By: a guest on
Apr 25th, 2012 | syntax:
C++ | size: 1.20 KB | hits: 16 | expires: Never
#include <QtCore/QAbstractItemModel>
#include <QtCore/QLatin1String>
#include <QtGui/QGuiApplication>
#include <QtQml/QtQml>
#include <QtQuick/QQuickView>
#include <QWidget>
#include <QLabel>
#include <QComboBox>
#include <QVBoxLayout>
#include <QPushButton>
#include <QApplication>
#include <QDebug>
int main(int argc, char** argv)
{
/*QGuiApplication app(argc, argv);
qmlRegisterType<PopupWindow>("ComboTest", 1, 0, "PopupWindow");
QQuickView *view = new QQuickView;
view->setSource(QUrl::fromLocalFile("main.qml"));
view->show();*/
QApplication app(argc, argv);
QWidget *win = new QWidget;
QVBoxLayout *layout = new QVBoxLayout;
QComboBox *combo = new QComboBox;
combo->addItem("AAAaaAAAaAA");
combo->addItem("BBBbbBBbbBB");
combo->addItem("CCCCccCCCcC");
combo->addItem("CCC");
combo->setEditable(true);
//combo->setCurrentIndex(-1);
qDebug() << combo->currentIndex();
layout->addWidget(new QLabel("(Label)ComboBox:"));
layout->addWidget(new QPushButton("PushButton"));
layout->addWidget(combo);
win->setBaseSize(400, 200);
win->setLayout(layout);
win->show();
return app.exec();
}