コード例 #1
0
ファイル: main.cpp プロジェクト: lemmore22/pspe4all
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
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QListWidget* list = new QListWidget();
    list->show();
}
コード例 #3
0
ファイル: main.cpp プロジェクト: rasmadeus/AutoTM
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
0
ファイル: main.cpp プロジェクト: rasmadeus/AutoTM
int main(int argc, char** argv)
{
    QApplication TM1Reader(argc, argv);
        QString dir = QFileDialog::getExistingDirectory();
        Package* tm1 = PackagesMaker::makeAndFillPackage(Package::TM1_9M100, dir);
        tm1->writeRows(dir);
        QListWidget lw;
        lw.addItems(tm1->getRows());
        lw.show();
        delete tm1;
    return TM1Reader.exec();
}
コード例 #5
0
ファイル: main.cpp プロジェクト: BGmot/Qt
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();
}
コード例 #6
0
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()) {
        selectionChanged = false;
        for (int i = 0; i<listWidget->count(); i++) {
            item = 0;
            item = listWidget->item(i);
            DrawableFrame *drawableFrame = dynamic_cast<DrawableFrame*>(viewer->drawableList()[i]);
            if (item && item->isSelected()) {
                if(!drawableFrame->parameter()->show()) {
                    drawableFrame->parameter()->setShow(true);
                    selectionChanged = true;
                }
                if(pointClouds[i] == 0) {
                    pointClouds[i] = new Frame();
                    boss_map::ImageBLOB* fromDepthBlob = trackerFrames[i]->depthImage.get();
                    DepthImage depthImage;
                    depthImage.fromCvMat(fromDepthBlob->cvImage());
                    DepthImage::scale(scaledDepthImage, depthImage, scale);
                    converter->compute(*pointClouds[i], scaledDepthImage);
                    drawableFrame->setFrame(pointClouds[i]);
                    delete fromDepthBlob;
                }
            } else {
                drawableFrame->parameter()->setShow(false);
                selectionChanged = true;
            }
        }
        if (selectionChanged)
            viewer->updateGL();

        application.processEvents();
    }

    return 0;
}
コード例 #7
0
ファイル: main.cpp プロジェクト: ifhw/study
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();
}