本文整理汇总了C++中QListWidget::show方法的典型用法代码示例。如果您正苦于以下问题:C++ QListWidget::show方法的具体用法?C++ QListWidget::show怎么用?C++ QListWidget::show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QListWidget
的用法示例。
在下文中一共展示了QListWidget::show方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
a.setStyle("cleanlooks");
#if 0
if (!QSystemTrayIcon::isSystemTrayAvailable())
{
QMessageBox::critical
(
0,
QObject::tr("Systray"),
QObject::tr("There is no system tray on this system.")
);
return 1;
}
QApplication::setQuitOnLastWindowClosed(false);
#endif
#if 0
Allegrex::create_instructions_directory();
Allegrex::create_interpreter_directory();
Allegrex::create_disassembler_directory();
QPspe4all w;
w.show();
#else
if (true/*emulator.check_integrity()*/)
{
QPspe4all w;
w.show();
psp::memw(0x00010000) = 0xDEADBEEF;
psp::memw(0x04000000) = 0xDEADC0DE;
psp::memw(0x08000000) = 0xE117C0DE;
QStringList list;
#define IDEF(n, m, s, x) list.append(QString("%1/%2 : %3").arg(uint(s), 8, 16, QChar('0')).arg(uint(m), 8, 16, QChar('0')).arg(Allegrex::decode_instruction(s)->opcode_name()));
#include "emulator/allegrex/allegrex.def"
#undef IDEF
QListWidget l;
l.setFont(QFont("Terminal"));
l.insertItems(0, list);
l.show();
return a.exec();
}
#endif
return a.exec();
return 1;
}
示例2: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QListWidget* list = new QListWidget();
list->show();
}
示例3: main
int main(int argc, char** argv)
{
QApplication PackagesMaker(argc, argv);
Package* tm1 = PackagesMaker::makePackage(Package::TM1_9M100);
tm1->readRows(QStringList() << ":/1.txt" << ":/2.txt" << ":/3.txt" << ":/4.txt");
QListWidget lw;
lw.setWindowTitle("tm test");
lw.addItems(tm1->getRows());
lw.show();
return PackagesMaker.exec();
}
示例4: main
int main(int argc, char **argv)
{
Q_INIT_RESOURCE(defaultprototypes);
QApplication app(argc, argv);
//! [1]
QScriptEngine engine;
ListWidgetItemPrototype lwiProto;
engine.setDefaultPrototype(qMetaTypeId<QListWidgetItem*>(),
engine.newQObject(&lwiProto));
ListWidgetPrototype lwProto;
engine.setDefaultPrototype(qMetaTypeId<QListWidget*>(),
engine.newQObject(&lwProto));
//! [1]
//! [2]
QListWidget listWidget;
engine.globalObject().setProperty("listWidget",
engine.newQObject(&listWidget));
//! [2]
QFile file(":/code.js");
file.open(QIODevice::ReadOnly);
QScriptValue result = engine.evaluate(file.readAll());
file.close();
if (engine.hasUncaughtException()) {
int lineNo = engine.uncaughtExceptionLineNumber();
qWarning() << "line" << lineNo << ":" << result.toString();
}
#if defined(Q_OS_SYMBIAN)
listWidget.showMaximized();
#else
listWidget.show();
#endif
return app.exec();
}
示例5: main
int main (int argc, char** argv) {
// Handle input
float pointSize;
float pointStep;
float alpha;
int applyTransform;
int step;
string logFilename;
string configFilename;
float di_scaleFactor;
float scale;
g2o::CommandArgs arg;
arg.param("vz_pointSize", pointSize, 1.0f, "Size of the points where are visualized");
arg.param("vz_transform", applyTransform, 1, "Choose if you want to apply the absolute transform of the point clouds");
arg.param("vz_step", step, 1, "Visualize a point cloud each vz_step point clouds");
arg.param("vz_alpha", alpha, 1.0f, "Alpha channel value used for the color points");
arg.param("vz_pointStep", pointStep, 1, "Step at which point are drawn");
arg.param("vz_scale", scale, 2, "Depth image size reduction factor");
arg.param("di_scaleFactor", di_scaleFactor, 0.001f, "Scale factor to apply to convert depth images in meters");
arg.paramLeftOver("configFilename", configFilename, "", "Configuration filename", true);
arg.paramLeftOver("logFilename", logFilename, "", "Log filename", true);
arg.parseArgs(argc, argv);
// Create GUI
QApplication application(argc,argv);
QWidget *mainWindow = new QWidget();
mainWindow->setWindowTitle("pwn_tracker_log_viewer");
QHBoxLayout *hlayout = new QHBoxLayout();
mainWindow->setLayout(hlayout);
QVBoxLayout *vlayout = new QVBoxLayout();
hlayout->addItem(vlayout);
QVBoxLayout *vlayout2 = new QVBoxLayout();
hlayout->addItem(vlayout2);
hlayout->setStretch(1, 1);
QListWidget* listWidget = new QListWidget(mainWindow);
listWidget->setSelectionMode(QAbstractItemView::MultiSelection);
vlayout->addWidget(listWidget);
PWNQGLViewer* viewer = new PWNQGLViewer(mainWindow);
vlayout2->addWidget(viewer);
Eigen::Isometry3f T;
T.setIdentity();
T.matrix().row(3) << 0.0f, 0.0f, 0.0f, 1.0f;
// Read config file
cout << "Loading config file..." << endl;
Aligner *aligner;
DepthImageConverter *converter;
std::vector<Serializable*> instances = readConfig(aligner, converter, configFilename.c_str());
converter->projector()->scale(1.0f/scale);
cout << "... done" << endl;
// Read and parse log file
std::vector<boss::Serializable*> objects;
std::vector<PwnTrackerFrame*> trackerFrames;
std::vector<PwnTrackerRelation*> trackerRelations;
Deserializer des;
des.setFilePath(logFilename);
cout << "Loading log file..." << endl;
load(trackerFrames, trackerRelations, objects, des, step);
cout << "... done" << endl;
// Load the drawable list with the PwnTrackerFrame objects
std::vector<Frame*> pointClouds;
pointClouds.resize(trackerFrames.size());
Frame *dummyFrame = 0;
std::fill(pointClouds.begin(), pointClouds.end(), dummyFrame);
for(size_t i = 0; i < trackerFrames.size(); i++) {
PwnTrackerFrame *pwnTrackerFrame = trackerFrames[i];
char nummero[1024];
sprintf(nummero, "%05d", (int)i);
listWidget->addItem(QString(nummero));
QListWidgetItem *lastItem = listWidget->item(listWidget->count() - 1);
Isometry3f transform = Isometry3f::Identity();
if(applyTransform) {
isometry3d2f(transform, pwnTrackerFrame->transform());
transform = transform*pwnTrackerFrame->sensorOffset;
}
transform.matrix().row(3) << 0.0f, 0.0f, 0.0f, 1.0f;
GLParameterFrame *frameParams = new GLParameterFrame();
frameParams->setStep(pointStep);
frameParams->setShow(false);
DrawableFrame* drawableFrame = new DrawableFrame(transform, frameParams, pointClouds[i]);
viewer->addDrawable(drawableFrame);
}
// Manage GUI
viewer->init();
mainWindow->show();
viewer->show();
listWidget->show();
viewer->setAxisIsDrawn(true);
bool selectionChanged = false;
QListWidgetItem *item = 0;
DepthImage depthImage;
DepthImage scaledDepthImage;
while (mainWindow->isVisible()) {
//.........这里部分代码省略.........
示例6: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
// QListWidget
QListWidget listWidget;
// 一种添加项目的简便方法
new QListWidgetItem("a", &listWidget);
// 添加项目的另一种方法,这样还可以进行各种设置
QListWidgetItem *listWidgetItem = new QListWidgetItem;
listWidgetItem->setText("b");
listWidgetItem->setIcon(QIcon("../modelView2/yafeilinux.png"));
listWidgetItem->setToolTip("this is b!");
listWidget.insertItem(1, listWidgetItem);
// 设置排序为倒序
listWidget.sortItems(Qt::DescendingOrder);
// 显示列表部件
listWidget.show();
// QTreeWidget
QTreeWidget treeWidget;
// 必须设置列数
treeWidget.setColumnCount(2);
// 设置标头
QStringList headers;
headers << "name" << "year";
treeWidget.setHeaderLabels(headers);
// 添加项目
QTreeWidgetItem *grade1 = new QTreeWidgetItem(&treeWidget);
grade1->setText(0,"Grade1");
QTreeWidgetItem *student = new QTreeWidgetItem(grade1);
student->setText(0,"Tom");
student->setText(1,"1986");
QTreeWidgetItem *grade2 = new QTreeWidgetItem(&treeWidget, grade1);
grade2->setText(0,"Grade2");
treeWidget.show();
// QTableWidget
// 创建表格部件,同时指定行数和列数
QTableWidget tableWidget(3, 2);
// 创建表格项目,并插入到指定单元
QTableWidgetItem *tableWidgetItem = new QTableWidgetItem("qt");
tableWidget.setItem(1, 1, tableWidgetItem);
// 创建表格项目,并将它们作为标头
QTableWidgetItem *headerV = new QTableWidgetItem("first");
tableWidget.setVerticalHeaderItem(0,headerV);
QTableWidgetItem *headerH = new QTableWidgetItem("ID");
tableWidget.setHorizontalHeaderItem(0,headerH);
tableWidget.show();
// 为listWidget启用拖放
// 设置选择模式为单选
listWidget.setSelectionMode(QAbstractItemView::SingleSelection);
// 启用拖动
listWidget.setDragEnabled(true);
// 设置接受拖放
listWidget.viewport()->setAcceptDrops(true);
// 设置显示将要被放置的位置
listWidget.setDropIndicatorShown(true);
// 设置拖放模式为移动项目,如果不设置,默认为复制项目
listWidget.setDragDropMode(QAbstractItemView::InternalMove);
return app.exec();
}