当前位置: 首页>>代码示例>>C++>>正文


C++ QTreeWidgetItem::setText方法代码示例

本文整理汇总了C++中QTreeWidgetItem::setText方法的典型用法代码示例。如果您正苦于以下问题:C++ QTreeWidgetItem::setText方法的具体用法?C++ QTreeWidgetItem::setText怎么用?C++ QTreeWidgetItem::setText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QTreeWidgetItem的用法示例。


在下文中一共展示了QTreeWidgetItem::setText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: loadCrsList

void QgsProjectionSelectionTreeWidget::loadCrsList( QSet<QString> *crsFilter )
{
  if ( mProjListDone )
    return;

  // convert our Coordinate Reference System filter into the SQL expression
  QString sqlFilter = ogcWmsCrsFilterAsSqlExpression( crsFilter );

  // Create the top-level nodes for the list view of projections
  // Make in an italic font to distinguish them from real projections
  //
  // Geographic coordinate system node
  mGeoList = new QTreeWidgetItem( lstCoordinateSystems, QStringList( tr( "Geographic Coordinate Systems" ) ) );

  QFont fontTemp = mGeoList->font( 0 );
  fontTemp.setItalic( true );
  fontTemp.setBold( true );
  mGeoList->setFont( 0, fontTemp );
  mGeoList->setIcon( 0, QgsApplication::getThemeIcon( QStringLiteral( "/mIconProjectionEnabled.svg" ) ) );

  // Projected coordinate system node
  mProjList = new QTreeWidgetItem( lstCoordinateSystems, QStringList( tr( "Projected Coordinate Systems" ) ) );

  fontTemp = mProjList->font( 0 );
  fontTemp.setItalic( true );
  fontTemp.setBold( true );
  mProjList->setFont( 0, fontTemp );
  mProjList->setIcon( 0, QgsApplication::getThemeIcon( QStringLiteral( "/transformed.svg" ) ) );

  //bail out in case the projections db does not exist
  //this is necessary in case the pc is running linux with a
  //read only filesystem because otherwise sqlite will try
  //to create the db file on the fly

  if ( !QFileInfo::exists( mSrsDatabaseFileName ) )
  {
    mProjListDone = true;
    return;
  }

  // open the database containing the spatial reference data
  sqlite3 *database = nullptr;
  int rc = sqlite3_open_v2( mSrsDatabaseFileName.toUtf8().data(), &database, SQLITE_OPEN_READONLY, nullptr );
  if ( rc )
  {
    // XXX This will likely never happen since on open, sqlite creates the
    //     database if it does not exist.
    showDBMissingWarning( mSrsDatabaseFileName );
    return;
  }

  const char *tail = nullptr;
  sqlite3_stmt *stmt = nullptr;
  // Set up the query to retrieve the projection information needed to populate the list
  //note I am giving the full field names for clarity here and in case someone
  //changes the underlying view TS
  QString sql = QStringLiteral( "select description, srs_id, upper(auth_name||':'||auth_id), is_geo, name, parameters, deprecated from vw_srs where %1 order by name,description" )
                .arg( sqlFilter );

  rc = sqlite3_prepare( database, sql.toUtf8(), sql.toUtf8().length(), &stmt, &tail );
  // XXX Need to free memory from the error msg if one is set
  if ( rc == SQLITE_OK )
  {
    QTreeWidgetItem *newItem = nullptr;
    // Cache some stuff to speed up creating of the list of projected
    // spatial reference systems
    QString previousSrsType;
    QTreeWidgetItem *previousSrsTypeNode = nullptr;

    while ( sqlite3_step( stmt ) == SQLITE_ROW )
    {
      // check to see if the srs is geographic
      int isGeo = sqlite3_column_int( stmt, 3 );
      if ( isGeo )
      {
        // this is a geographic coordinate system
        // Add it to the tree (field 0)
        newItem = new QTreeWidgetItem( mGeoList, QStringList( QString::fromUtf8( ( char * )sqlite3_column_text( stmt, 0 ) ) ) );

        // display the authority name (field 2) in the second column of the list view
        newItem->setText( AuthidColumn, QString::fromUtf8( ( char * )sqlite3_column_text( stmt, 2 ) ) );

        // display the qgis srs_id (field 1) in the third column of the list view
        newItem->setText( QgisCrsIdColumn, QString::fromUtf8( ( char * )sqlite3_column_text( stmt, 1 ) ) );
      }
      else
      {
        // This is a projected srs
        QTreeWidgetItem *node = nullptr;
        QString srsType = QString::fromUtf8( ( char * )sqlite3_column_text( stmt, 4 ) );
        // Find the node for this type and add the projection to it
        // If the node doesn't exist, create it
        if ( srsType == previousSrsType )
        {
          node = previousSrsTypeNode;
        }
        else
        {
          // Different from last one, need to search
          QList<QTreeWidgetItem *> nodes = lstCoordinateSystems->findItems( srsType, Qt::MatchExactly | Qt::MatchRecursive, NameColumn );
//.........这里部分代码省略.........
开发者ID:anitagraser,项目名称:QGIS,代码行数:101,代码来源:qgsprojectionselectiontreewidget.cpp

示例2: checkMltComponents

void Wizard::checkMltComponents()
{
    m_mltCheck.programList->setColumnCount(2);
    m_mltCheck.programList->setRootIsDecorated(false);
    m_mltCheck.programList->setHeaderHidden(true);
    QSize itemSize(20, fontMetrics().height() * 2.5);
    m_mltCheck.programList->setColumnWidth(0, 30);
    m_mltCheck.programList->setIconSize(QSize(24, 24));


    QTreeWidgetItem *mltitem = new QTreeWidgetItem(m_mltCheck.programList);

    QTreeWidgetItem *meltitem = new QTreeWidgetItem(m_mltCheck.programList, QStringList() << QString() << i18n("Melt") + " (" + KdenliveSettings::rendererpath() + ')');
    meltitem->setData(1, Qt::UserRole, i18n("Required for rendering (part of MLT package)"));
    meltitem->setSizeHint(0, itemSize);
    meltitem->setIcon(0, m_okIcon);

    // Check MLT's installed producers
    QProcess checkProcess;
    checkProcess.start(KdenliveSettings::rendererpath(), QStringList() << "-query" << "producer");
    if (!checkProcess.waitForStarted()) {
        meltitem->setIcon(0, m_badIcon);
        meltitem->setData(1, Qt::UserRole, i18n("Error starting MLT's command line player (melt)"));
        button(QWizard::NextButton)->setEnabled(false);
    } else {
        checkProcess.waitForFinished();
        QByteArray result = checkProcess.readAllStandardError();

        // Check MLT avformat module
        QTreeWidgetItem *avformatItem = new QTreeWidgetItem(m_mltCheck.programList, QStringList() << QString() << i18n("Avformat module (FFmpeg)"));
        avformatItem->setData(1, Qt::UserRole, i18n("Required to work with various video formats (hdv, mpeg, flash, ...)"));
        avformatItem->setSizeHint(0, itemSize);
        if (!result.contains("- avformat")) {
            avformatItem->setIcon(0, m_badIcon);
            m_mltCheck.tabWidget->setTabEnabled(1, false);
        } else {
            avformatItem->setIcon(0, m_okIcon);
            // Make sure we have MLT > 0.3.4
            bool recentMlt = false;
            int version = 0;
            QString mltVersion;
            QString exepath = KStandardDirs::findExe("pkg-config");
            if (!exepath.isEmpty()) {
                checkProcess.start(exepath, QStringList() << "--variable=version" << "mlt++");
                if (!checkProcess.waitForStarted()) {
                    kDebug() << "// Error querying MLT's version";
                } else {
                    checkProcess.waitForFinished();
                    mltVersion = checkProcess.readAllStandardOutput();
                    version = 100 * mltVersion.section('.', 0, 0).toInt() + 10 * mltVersion.section('.', 1, 1).toInt() + mltVersion.section('.', 2, 2).toInt();
                    kDebug() << "// FOUND MLT's pkgconfig version: " << version;
                    if (version > 34) recentMlt = true;
                }
            }
            if (version == 0) {
                checkProcess.start(KdenliveSettings::rendererpath(), QStringList() << "--version");
                if (!checkProcess.waitForStarted()) {
                    kDebug() << "// Error querying MLT's version";
                } else {
                    checkProcess.waitForFinished();
                    mltVersion = checkProcess.readAllStandardError();
                    mltVersion = mltVersion.section('\n', 0, 0).simplified();
                    mltVersion = mltVersion.section(' ', -1).simplified();
                    version = 100 * mltVersion.section('.', 0, 0).toInt() + 10 * mltVersion.section('.', 1, 1).toInt() + mltVersion.section('.', 2, 2).toInt();
                    kDebug() << "// FOUND MLT version: " << version;
                    if (version >= 40) recentMlt = true;
                }
            }

            mltitem->setText(1, i18n("MLT version: %1", mltVersion.simplified()));
            mltitem->setSizeHint(0, itemSize);
            if (version < recommendedMltVersion) {
                mltitem->setData(1, Qt::UserRole, i18n("Please upgrade to the latest MLT version"));
                mltitem->setIcon(0, m_badIcon);
            } else {
                mltitem->setData(1, Qt::UserRole, i18n("MLT version is correct"));
                mltitem->setIcon(0, m_okIcon);
            }

            if (recentMlt) {
                // Check installed audio codecs
                QProcess checkProcess2;
                checkProcess2.start(KdenliveSettings::rendererpath(), QStringList() << "noise:" << "-consumer" << "avformat" << "acodec=list");
                if (!checkProcess2.waitForStarted()) {
                    m_mltCheck.tabWidget->setTabEnabled(1, false);
                    kDebug() << "// Error parsing MLT's avformat codecs";
                } else {
                    checkProcess2.waitForFinished();
                    QByteArray codecList = checkProcess2.readAllStandardError();
                    QString acodecList(codecList);
                    QStringList result;
                    QStringList alist = acodecList.split('\n', QString::SkipEmptyParts);
                    for (int i = 0; i < alist.count(); i++) {
                        if (alist.at(i).contains("- ")) result.append(alist.at(i).section("- ", 1).simplified().toLower());
                    }
                    m_mltCheck.acodecs_list->addItems(result);
                    KdenliveSettings::setAudiocodecs(result);
                    //kDebug()<<"// FOUND LIST:\n\n"<<m_audioCodecs<<"\n\n++++++++++++++++++++";
                }
                // Check video codecs
//.........这里部分代码省略.........
开发者ID:rayl,项目名称:kdenlive,代码行数:101,代码来源:wizard.cpp

示例3: templ

CommitImpl::CommitImpl(Git* g, bool amend) : git(g) {

	// adjust GUI
	setAttribute(Qt::WA_DeleteOnClose);
	setupUi(this);
	textEditMsg->setFont(TYPE_WRITER_FONT);

	QVector<QSplitter*> v(1, splitter);
	QGit::restoreGeometrySetting(CMT_GEOM_KEY, this, &v);

	QSettings settings;
	QString templ(settings.value(CMT_TEMPL_KEY, CMT_TEMPL_DEF).toString());
	QString msg;
	QDir d;
	if (d.exists(templ))
		readFromFile(templ, msg);

	// set-up files list
	const RevFile* f = git->getFiles(ZERO_SHA);
	for (int i = 0; f && i < f->count(); ++i) { // in case of amend f could be null

		bool inIndex = f->statusCmp(i, RevFile::IN_INDEX);
		bool isNew = (f->statusCmp(i, RevFile::NEW) || f->statusCmp(i, RevFile::UNKNOWN));
		QColor myColor = QPalette().color(QPalette::WindowText);
		if (isNew)
			myColor = Qt::darkGreen;
		else if (f->statusCmp(i, RevFile::DELETED))
			myColor = Qt::red;

		QTreeWidgetItem* item = new QTreeWidgetItem(treeWidgetFiles);
		item->setText(0, git->filePath(*f, i));
		item->setText(1, inIndex ? "Updated in index" : "Not updated in index");
		item->setCheckState(0, inIndex || !isNew ? Qt::Checked : Qt::Unchecked);
		item->setForeground(0, myColor);
	}
	treeWidgetFiles->resizeColumnToContents(0);

	// compute cursor offsets. Take advantage of fixed width font
	textEditMsg->setPlainText("\nx\nx"); // cursor doesn't move on empty text
	textEditMsg->moveCursor(QTextCursor::Start);
	textEditMsg->verticalScrollBar()->setValue(0);
	textEditMsg->horizontalScrollBar()->setValue(0);
	int y0 = textEditMsg->cursorRect().y();
	int x0 = textEditMsg->cursorRect().x();
	textEditMsg->moveCursor(QTextCursor::Down);
	textEditMsg->moveCursor(QTextCursor::Right);
	textEditMsg->verticalScrollBar()->setValue(0);
	int y1 = textEditMsg->cursorRect().y();
	int x1 = textEditMsg->cursorRect().x();
	ofsX = x1 - x0;
	ofsY = y1 - y0;
	textEditMsg->moveCursor(QTextCursor::Start);
	textEditMsg_cursorPositionChanged();

	if (lastMsgBeforeError.isEmpty()) {
		// setup textEditMsg with old commit message to be amended
		QString status("");
		if (amend)
			status = git->getLastCommitMsg();

		// setup textEditMsg with default value if user opted to do so (default)
		if (testFlag(USE_CMT_MSG_F, FLAGS_KEY))
			status += git->getNewCommitMsg();

		msg = status.trimmed();
	} else
		msg = lastMsgBeforeError;

	textEditMsg->setPlainText(msg);
	textEditMsg->setFocus();

	// if message is not changed we avoid calling refresh
	// to change patch name in stgCommit()
	origMsg = msg;

	// setup button functions
	if (amend) {
		if (git->isStGITStack()) {
			pushButtonOk->setText("&Add to top");
			pushButtonOk->setShortcut(QKeySequence("Alt+A"));
			pushButtonOk->setToolTip("Refresh top stack patch");
		} else {
			pushButtonOk->setText("&Amend");
			pushButtonOk->setShortcut(QKeySequence("Alt+A"));
			pushButtonOk->setToolTip("Amend latest commit");
		}
		connect(pushButtonOk, SIGNAL(clicked()),
			this, SLOT(pushButtonAmend_clicked()));
	} else {
		if (git->isStGITStack()) {
			pushButtonOk->setText("&New patch");
			pushButtonOk->setShortcut(QKeySequence("Alt+N"));
			pushButtonOk->setToolTip("Create a new patch");
		}
		connect(pushButtonOk, SIGNAL(clicked()),
			this, SLOT(pushButtonCommit_clicked()));
	}
	connect(treeWidgetFiles, SIGNAL(customContextMenuRequested(const QPoint&)),
	        this, SLOT(contextMenuPopup(const QPoint&)));
	connect(textEditMsg, SIGNAL(cursorPositionChanged()),
//.........这里部分代码省略.........
开发者ID:rhaschke,项目名称:qgit,代码行数:101,代码来源:commitimpl.cpp

示例4: updateFrames

void MainWindow::updateFrames() {
    if (core == NULL)
        return;

    static bool first_time = true;
    if (first_time) {
        setup_mem();
        this->add_output(" > Adding binary information to notepad");
        notepadDock->setText("# Binary information\n\n" + core->cmd("i") +
                             "\n" + core->cmd("ie") + "\n" + core->cmd("iM") + "\n");
        //first_time = false;
    } else {
        refreshMem("");
    }

    refreshFlagspaces();

    auto spi = QAbstractItemView::ScrollPerItem;
    auto spp = QAbstractItemView::ScrollPerPixel;

    // TODO: make this configurable by the user?
    const bool use_scrollperpixel = true;
    if (use_scrollperpixel) {
        this->flagsDock->flagsTreeWidget->setVerticalScrollMode(spp);
        this->symbolsDock->symbolsTreeWidget->setVerticalScrollMode(spp);
        this->importsDock->importsTreeWidget->setVerticalScrollMode(spp);
        this->functionsDock->functionsTreeWidget->setVerticalScrollMode(spp);
        this->stringsDock->stringsTreeWidget->setVerticalScrollMode(spp);
        this->relocsDock->relocsTreeWidget->setVerticalScrollMode(spp);
        this->memoryDock->xreFromTreeWidget_2->setVerticalScrollMode(spp);
        this->memoryDock->xrefToTreeWidget_2->setVerticalScrollMode(spp);
    } else {
        this->flagsDock->flagsTreeWidget->setVerticalScrollMode(spi);
        this->symbolsDock->symbolsTreeWidget->setVerticalScrollMode(spi);
        this->importsDock->importsTreeWidget->setVerticalScrollMode(spi);
        this->functionsDock->functionsTreeWidget->setVerticalScrollMode(spi);
        this->stringsDock->stringsTreeWidget->setVerticalScrollMode(spi);
        this->relocsDock->relocsTreeWidget->setVerticalScrollMode(spi);
        this->memoryDock->xreFromTreeWidget_2->setVerticalScrollMode(spi);
        this->memoryDock->xrefToTreeWidget_2->setVerticalScrollMode(spi);
    }

    this->functionsDock->fillFunctions();

    this->importsDock->fillImports();

    // FIXME, doesn't work bc it sorts strings, not numbers... sigh
    /*
      Use QListWidgetItem::setData() not the constructor to set your value. Then all will work like you expect it to work.

      int yourIntValue = 123456;
      QListWidgetItem *item = new QListWidgetItem;
      item->setData(Qt::DisplayRole, yourIntValue);
    */
    //this->importsDock->importsTreeWidget->sortByColumn(1, Qt::DescendingOrder);

    adjustColumns(this->importsDock->importsTreeWidget);

    this->relocsDock->relocsTreeWidget->clear();
    for (auto i: core->getList ("bin","relocs")) {
        QStringList pieces = i.split (",");
        if (pieces.length()==3)
            appendRow(this->relocsDock->relocsTreeWidget, pieces[0], pieces[1], pieces[2]);
    }
    adjustColumns(this->relocsDock->relocsTreeWidget);

    this->symbolsDock->fillSymbols();

    this->stringsDock->stringsTreeWidget->clear();
    for (auto i : core->getList ("bin", "strings")) {
        QStringList pieces = i.split (",");
        if (pieces.length () == 2)
            appendRow(this->stringsDock->stringsTreeWidget, pieces[0], pieces[1]);
    }
    adjustColumns(this->stringsDock->stringsTreeWidget);

    this->commentsDock->commentsTreeWidget->clear();
    QList<QList<QString>> comments = this->core->getComments();
    for (QList<QString> comment: comments) {
        /*
        QString name;
        //this->add_debug_output("Comment: " + comment[1] + ": " + comment[0]);
        RAnalFunction *fcn = this->core->functionAt(comment[1].toLongLong(0, 16));
        if (fcn != NULL) {
            name = fcn->name;
        } else {
            name = "";
        }
        */
        QString fcn_name = this->core->cmdFunctionAt(comment[1]);
        appendRow(this->commentsDock->commentsTreeWidget, comment[1], fcn_name, comment[0].remove('"'));
    }
    adjustColumns(this->commentsDock->commentsTreeWidget);

    // Add nested comments
    QMap<QString, QList<QList<QString>>> cmts = this->core->getNestedComments();
    for(auto cmt : cmts.keys()) {
        QTreeWidgetItem *item = new QTreeWidgetItem(this->commentsDock->nestedCommentsTreeWidget);
        item->setText(0, cmt);
        QList<QList<QString>> meow = cmts.value(cmt);
//.........这里部分代码省略.........
开发者ID:probonopd,项目名称:iaito,代码行数:101,代码来源:mainwindow.cpp

示例5: loadIdentities

void CreateCircleDialog::loadIdentities(uint32_t token)
{
#ifdef DEBUG_CREATE_CIRCLE_DIALOG 
	std::cerr << "CreateCircleDialog::loadIdentities(" << token << ")";
	std::cerr << std::endl;
#endif

	QTreeWidget *tree = ui.treeWidget_IdList;

	tree->clear();

	bool acceptAnonymous = ui.radioButton_ListAll->isChecked();
	bool acceptAllPGP = ui.radioButton_ListAllPGP->isChecked();
	//bool acceptKnownPGP = ui.radioButton_ListKnownPGP->isChecked();

	RsGxsIdGroup data;
	std::vector<RsGxsIdGroup> datavector;
	std::vector<RsGxsIdGroup>::iterator vit;
	if (!rsIdentity->getGroupData(token, datavector)) {
		std::cerr << "CreateCircleDialog::insertIdentities() Error getting GroupData";
		std::cerr << std::endl;
		return;
	}

    for(vit = datavector.begin(); vit != datavector.end(); ++vit) 
    {
	    data = (*vit);

	    /* do filtering */
	    bool ok = false;
	    if (acceptAnonymous) 
		    ok = true;
	    else if (acceptAllPGP) 
		    ok = data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID ;
	    else if (data.mPgpKnown)
		    ok = data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID ;

	    if (!ok) {
#ifdef DEBUG_CREATE_CIRCLE_DIALOG 
		    std::cerr << "CreateCircleDialog::insertIdentities() Skipping ID: " << data.mMeta.mGroupId;
		    std::cerr << std::endl;
#endif
		    continue;
	    }

	    QString  keyId = QString::fromStdString(data.mMeta.mGroupId.toStdString());
	    QString  nickname = QString::fromUtf8(data.mMeta.mGroupName.c_str());
	    QString  idtype = tr("Anon Id");
	    
	    QPixmap pixmap ;

    if(data.mImage.mSize == 0 || !pixmap.loadFromData(data.mImage.mData, data.mImage.mSize, "PNG"))
        pixmap = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(RsGxsId(data.mMeta.mGroupId))) ;

	    if (data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID) 
        	{
		    if (data.mPgpKnown) {
			    RsPeerDetails details;
			    rsPeers->getGPGDetails(data.mPgpId, details);
			    idtype = QString::fromUtf8(details.name.c_str());
		    } 
	    		else 
			    idtype = tr("PGP Linked Id");
		    
	    }

	    QTreeWidgetItem *item = new QTreeWidgetItem();
	    item->setText(RSCIRCLEID_COL_NICKNAME, nickname);
        item->setIcon(RSCIRCLEID_COL_NICKNAME, QIcon(pixmap));
	    item->setText(RSCIRCLEID_COL_KEYID, keyId);
	    item->setText(RSCIRCLEID_COL_IDTYPE, idtype);
	    tree->addTopLevelItem(item);

	    // External Circle.
	    if (mIsExistingCircle) 
	    {
		    // check if its in the circle.

		    // We use an explicit cast
		    //

		    if ( mCircleGroup.mInvitedMembers.find(RsGxsId(data.mMeta.mGroupId)) != mCircleGroup.mInvitedMembers.end())  /* found it */
			    addMember(keyId, idtype, nickname);
	    }
    }
}
开发者ID:MrKID,项目名称:RetroShare,代码行数:86,代码来源:CreateCircleDialog.cpp

示例6: reloadData

void DbStructureModel::reloadData(DBBrowserDB* db)
{
    // Save pointer to DB object
    m_db = db;

    beginResetModel();

    // Remove all data except for the root item
    while(rootItem->childCount())
    {
        delete rootItem->child(0);
        rootItem->removeChild(rootItem->child(0));
    }

    // Create the nodes for tables, indices, views and triggers
    QMap<QString, QTreeWidgetItem*> typeToParentItem;
    QTreeWidgetItem* itemTables = new QTreeWidgetItem(rootItem);
    itemTables->setIcon(0, QIcon(QString(":/icons/table")));
    itemTables->setText(0, tr("Tables (%1)").arg(db->objMap.values("table").count()));
    typeToParentItem.insert("table", itemTables);
    QTreeWidgetItem* itemIndices = new QTreeWidgetItem(rootItem);
    itemIndices->setIcon(0, QIcon(QString(":/icons/index")));
    itemIndices->setText(0, tr("Indices (%1)").arg(db->objMap.values("index").count()));
    typeToParentItem.insert("index", itemIndices);
    QTreeWidgetItem* itemViews = new QTreeWidgetItem(rootItem);
    itemViews->setIcon(0, QIcon(QString(":/icons/view")));
    itemViews->setText(0, tr("Views (%1)").arg(db->objMap.values("view").count()));
    typeToParentItem.insert("view", itemViews);
    QTreeWidgetItem* itemTriggers = new QTreeWidgetItem(rootItem);
    itemTriggers->setIcon(0, QIcon(QString(":/icons/trigger")));
    itemTriggers->setText(0, tr("Triggers (%1)").arg(db->objMap.values("trigger").count()));
    typeToParentItem.insert("trigger", itemTriggers);

    // Get all database objects and sort them by their name
    QMultiMap<QString, DBBrowserObject> dbobjs;
    for(objectMap::ConstIterator it=db->objMap.begin(); it != db->objMap.end(); ++it)
        dbobjs.insert((*it).getname(), (*it));

    // Add the actual table objects
    for(QMultiMap<QString, DBBrowserObject>::ConstIterator it=dbobjs.begin(); it != dbobjs.end(); ++it)
    {
        // Object node
        QTreeWidgetItem *tableItem = new QTreeWidgetItem(typeToParentItem.value((*it).gettype()));
        tableItem->setIcon(0, QIcon(QString(":/icons/%1").arg((*it).gettype())));
        tableItem->setText(0, (*it).getname());
        tableItem->setText(1, (*it).gettype());
        tableItem->setText(3, (*it).getsql());

        // If it is a table or view add the field Nodes
        if((*it).gettype() == "table" || (*it).gettype() == "view")
        {
            for(int i=0; i < it->fldmap.size(); ++i)
            {
                QTreeWidgetItem *fldItem = new QTreeWidgetItem(tableItem);
                fldItem->setText(0, (*it).fldmap.at(i)->name());
                fldItem->setText(1, "field");
                fldItem->setText(2, (*it).fldmap.at(i)->type());
                fldItem->setIcon(0, QIcon(":/icons/field"));
            }
        }
    }

    // Refresh the view
    endResetModel();
}
开发者ID:stretchtiberius,项目名称:sqlitebrowser,代码行数:65,代码来源:DbStructureModel.cpp

示例7: ShowArchiveList

void DetailsDialog::ShowArchiveList()
{
	// show list of files in given archive-file
	
	QString szFile = m_pParentDigestList->GetFullPathToEntry(m_pCurrentEntry);
	setWindowTitle(szFile);
	
	if (m_pCurrentEntry->m_FileType.m_enFileType == HEADERTYPE_LZX)
	{
		if (m_pLzxLib == nullptr)
		{
			m_pLzxLib = new QLZXLib(this);
		}
		
		try
		{
			QLZXLib::tEntryInfoList lstArchiveInfo;
			
			// set given file as archive
			m_pLzxLib->SetArchive(szFile);
		
			// collect list of files
			m_pLzxLib->List(lstArchiveInfo);
			
			// note: following is temp listing..
			
			QTreeWidgetItem *pTopItem = new QTreeWidgetItem((QTreeWidgetItem*)0);
			pTopItem->setText(0, szFile);
			ui->archiveList->addTopLevelItem(pTopItem);
			
			auto it = lstArchiveInfo.begin();
			auto itEnd = lstArchiveInfo.end();
			while (it != itEnd)
			{
				QLZXLib::CEntryInfo &Entry = (*it);
				if (Entry.m_szFileName.length() < 1)
				{
					++it;
					continue;
				}
				
				QTreeWidgetItem *pSubItem = new QTreeWidgetItem(pTopItem);
				pSubItem->setText(0, Entry.m_szFileName);
				pSubItem->setText(1, QString::number(Entry.m_ulUnpackedSize)); // always given
				
				// TODO: need to extract files to get hashes..
				//
				// also, add each extracted file to our list
				// so we can lookup hash-matches:
				// set current archive as parent of each of those
				//
				//CFileEntry *pEntry = new CFileEntry();
				//pEntry->m_pParentEntry = m_pCurrentEntry;
				//m_DigestList.m_FileData.AddFoundFile();
				
				pTopItem->addChild(pSubItem);
				++it;
			}
			
			ui->archiveList->resizeColumnToContents(0);
		}
		catch (std::exception &exp)
		{
			QMessageBox::warning(this, "Error viewing",
								 QString::fromLocal8Bit(exp.what()),
								 QMessageBox::Ok);
								 
			//ui->lblDecrunch->setText(QString::fromLocal8Bit(exp.what()));
		}
	}
	else if (m_pCurrentEntry->m_FileType.m_enFileType == HEADERTYPE_LHA)
	{
		if (m_pLhaLib == nullptr)
		{
			m_pLhaLib = new QLhALib(this);
		}
		
		try
		{
			QLhALib::tArchiveEntryList lstArchiveInfo;
			
			// set given file as archive
			m_pLhaLib->SetArchive(szFile);
		
			// collect list of files
			m_pLhaLib->List(lstArchiveInfo);

			// note: following is temp listing..
			
			QTreeWidgetItem *pTopItem = new QTreeWidgetItem((QTreeWidgetItem*)0);
			pTopItem->setText(0, szFile);
			ui->archiveList->addTopLevelItem(pTopItem);
			
			auto it = lstArchiveInfo.begin();
			auto itEnd = lstArchiveInfo.end();
			while (it != itEnd)
			{
				QLhALib::CArchiveEntry &Entry = (*it);
				if (Entry.m_szFileName.length() < 1)
				{
//.........这里部分代码省略.........
开发者ID:ipr,项目名称:qFileDigest,代码行数:101,代码来源:detailsdialog.cpp

示例8: InsertSections

void qtDLGPEEditor::InsertSections()
{
	QList<IMAGE_SECTION_HEADER> sections = m_pEManager->getSections(m_currentFile);
	if(sections.size() <= 0) return;

	QTreeWidgetItem *topElement;

	topElement = new QTreeWidgetItem();
	topElement->setText(0,"Sections");
	topElement->setText(1,"VA");
	topElement->setText(2,"Virtual Size");
	topElement->setText(3,"Ptr. Raw Data");
	topElement->setText(4,"Size of Raw");
	topElement->setText(5,"Characteristics");
	treePE->addTopLevelItem(topElement);

	for(int i = 0; i < sections.size(); i++)
	{
		QTreeWidgetItem *sectionElement;

		sectionElement = new QTreeWidgetItem(topElement);
		sectionElement->setText(0,QString::fromAscii((char*)sections.at(i).Name, sizeof(sections.at(i).Name)));
		sectionElement->setText(1,QString("%1").arg(sections.at(i).VirtualAddress,8,16,QChar('0')));
		sectionElement->setText(2,QString("%1").arg(sections.at(i).Misc.VirtualSize,8,16,QChar('0')));
		sectionElement->setText(3,QString("%1").arg(sections.at(i).PointerToRawData,8,16,QChar('0')));
		sectionElement->setText(4,QString("%1").arg(sections.at(i).SizeOfRawData,8,16,QChar('0')));
		sectionElement->setText(5,QString("%1").arg(sections.at(i).Characteristics,8,16,QChar('0')));
	}
}
开发者ID:blaquee,项目名称:Nanomite,代码行数:29,代码来源:qtDLGPEEditor.cpp

示例9: InsertHeaderData

void qtDLGPEEditor::InsertHeaderData(QTreeWidgetItem *topElement,QString ValueName,quint64 dwValue)
{
	QTreeWidgetItem *dataElement = new QTreeWidgetItem(topElement);
	dataElement->setText(0,ValueName);
	dataElement->setText(1,QString("%1").arg(dwValue,16,16,QChar('0')));
}
开发者ID:blaquee,项目名称:Nanomite,代码行数:6,代码来源:qtDLGPEEditor.cpp

示例10: addToList

void MainWindow::addToList() {
    QTextStream out(stdout);
    if(gameRunning) {
        if(ui->newWord->text().length() > 0) {
            //            *wordList << ui->newWord->text().toUpper();
            if(ui->newWord->text().length() > 2) {
                if(Hunspell_spell(spellChecker,ui->newWord->text().toAscii())) {
                    //                out << "correct spelling\n";
                    out.flush();

                    if(validWord()) {
                        bool isNewWord = true;
                        for(int i=0;i<letterItems[ui->newWord->text().length()]->childCount();i++) {
                            if(letterItems[ui->newWord->text().length()]->child(i)->text(0) == ui->newWord->text().toLower()) {
                                isNewWord = false;
                            }
                        }
                        if(isNewWord) {
                            QTreeWidgetItem *newItem = new QTreeWidgetItem(letterItems[ui->newWord->text().length()]);
                            newItem->setText(0,ui->newWord->text().toLower());
                            ui->wordTree->scrollToItem(newItem);
                            ui->wordTree->clearSelection();
                            newItem->setSelected(true);
                        }
                    }
                    else {
                        QTreeWidgetItem *newItem = new QTreeWidgetItem(letterItems[1]);
                        newItem->setText(0,ui->newWord->text().toLower());
                        ui->wordTree->scrollToItem(newItem);
                        ui->wordTree->clearSelection();
                        newItem->setSelected(true);
                    }
                }
                else {
                    //                out << "incorrect spelling\n";
                    out.flush();
                    QTreeWidgetItem *newItem = new QTreeWidgetItem(letterItems[0]);
                    newItem->setText(0,ui->newWord->text().toLower());
                    ui->wordTree->scrollToItem(newItem);
                    ui->wordTree->clearSelection();
                    newItem->setSelected(true);
                }
            }
            ui->wordTree->expandAll();
            //            ui->wordTable->setRowCount(10);
            //            ui->wordTable->setColumnCount(1);
            //            QTableWidgetItem *newItem = new QTableWidgetItem(ui->newWord->text());
            //            ui->wordTable->setItem(1,1,newItem);
            //            wordListModel->setStringList(*wordList);
            //            ui->wordList->scrollToBottom();
            //ui->wordList->itemDelegateForRow(0)->setProperty("color",QColor(255,0,0));
        }
    }
    int score = 0;
    int words = 0;
    int lettersScore[18] = {-1,-1,0,1,1,2,3,5,8,8,8,8,8,8,8,8,8,8};
    for(int i = 0; i<18; i++) {
        if(i != 2) {
            score += letterItems[i]->childCount()*lettersScore[i];
        }
        if(i > 2) {
            words += letterItems[i]->childCount();
        }
    }
    ui->score->display(score);
    ui->numWords->display(words);
    
    ui->newWord->setText("");
    for(int i = 0;i<16;i++) {
        button[i]->setStyleSheet("* { color: black;} ");
    }
    ui->newWord->setFocus();
}
开发者ID:PrasadHonrao,项目名称:zoggle,代码行数:73,代码来源:mainwindow.cpp

示例11: InsertOptionalHeader

void qtDLGPEEditor::InsertOptionalHeader()
{
	QTreeWidgetItem *topElement;
	topElement = new QTreeWidgetItem();
	topElement->setText(0,"IMAGE_OPTIONAL_HEADER");

	if(m_pEManager->is64BitFile(m_currentFile))
	{
		IMAGE_NT_HEADERS64 currentFileHeader = m_pEManager->getNTHeader64(m_currentFile);

		treePE->addTopLevelItem(topElement);
		InsertHeaderData(topElement,"AddressOfEntryPoint",currentFileHeader.OptionalHeader.AddressOfEntryPoint);
		InsertHeaderData(topElement,"BaseOfCode",currentFileHeader.OptionalHeader.BaseOfCode);
		InsertHeaderData(topElement,"CheckSum",currentFileHeader.OptionalHeader.CheckSum);
		//InsertHeaderData(topElement,"DataDirectory",currentFileHeader.OptionalHeader.DataDirectory);
		InsertHeaderData(topElement,"DllCharacteristics",currentFileHeader.OptionalHeader.DllCharacteristics);
		InsertHeaderData(topElement,"FileAlignment",currentFileHeader.OptionalHeader.FileAlignment);
		InsertHeaderData(topElement,"ImageBase",currentFileHeader.OptionalHeader.ImageBase);
		InsertHeaderData(topElement,"LoaderFlags",currentFileHeader.OptionalHeader.LoaderFlags);
		InsertHeaderData(topElement,"Magic",currentFileHeader.OptionalHeader.Magic);
		InsertHeaderData(topElement,"MajorImageVersion",currentFileHeader.OptionalHeader.MajorImageVersion);
		InsertHeaderData(topElement,"MajorLinkerVersion",currentFileHeader.OptionalHeader.MajorLinkerVersion);
		InsertHeaderData(topElement,"MajorOperatingSystemVersion",currentFileHeader.OptionalHeader.MajorOperatingSystemVersion);
		InsertHeaderData(topElement,"MajorSubsystemVersion",currentFileHeader.OptionalHeader.MajorSubsystemVersion);
		InsertHeaderData(topElement,"MinorImageVersion",currentFileHeader.OptionalHeader.MinorImageVersion);
		InsertHeaderData(topElement,"MinorLinkerVersion",currentFileHeader.OptionalHeader.MinorLinkerVersion);
		InsertHeaderData(topElement,"MinorOperatingSystemVersion",currentFileHeader.OptionalHeader.MinorOperatingSystemVersion);
		InsertHeaderData(topElement,"MinorSubsystemVersion",currentFileHeader.OptionalHeader.MinorSubsystemVersion);
		InsertHeaderData(topElement,"NumberOfRvaAndSizes",currentFileHeader.OptionalHeader.NumberOfRvaAndSizes);
		InsertHeaderData(topElement,"SectionAlignment",currentFileHeader.OptionalHeader.SectionAlignment);
		InsertHeaderData(topElement,"SizeOfCode",currentFileHeader.OptionalHeader.SizeOfCode);
		InsertHeaderData(topElement,"SizeOfHeaders",currentFileHeader.OptionalHeader.SizeOfHeaders);
		InsertHeaderData(topElement,"SizeOfHeapCommit",currentFileHeader.OptionalHeader.SizeOfHeapCommit);
		InsertHeaderData(topElement,"SizeOfHeapReserve",currentFileHeader.OptionalHeader.SizeOfHeapReserve);
		InsertHeaderData(topElement,"SizeOfImage",currentFileHeader.OptionalHeader.SizeOfImage);
		InsertHeaderData(topElement,"SizeOfInitializedData",currentFileHeader.OptionalHeader.SizeOfInitializedData);
		InsertHeaderData(topElement,"SizeOfStackCommit",currentFileHeader.OptionalHeader.SizeOfStackCommit);
		InsertHeaderData(topElement,"SizeOfStackReserve",currentFileHeader.OptionalHeader.SizeOfStackReserve);
		InsertHeaderData(topElement,"SizeOfUninitializedData",currentFileHeader.OptionalHeader.SizeOfUninitializedData);
		InsertHeaderData(topElement,"Subsystem",currentFileHeader.OptionalHeader.Subsystem);
		InsertHeaderData(topElement,"Win32VersionValue",currentFileHeader.OptionalHeader.Win32VersionValue);
	}
	else
	{
		IMAGE_NT_HEADERS32 currentFileHeader = m_pEManager->getNTHeader32(m_currentFile);

		treePE->addTopLevelItem(topElement);
		InsertHeaderData(topElement,"AddressOfEntryPoint",currentFileHeader.OptionalHeader.AddressOfEntryPoint);
		InsertHeaderData(topElement,"BaseOfCode",currentFileHeader.OptionalHeader.BaseOfCode);
		InsertHeaderData(topElement,"CheckSum",currentFileHeader.OptionalHeader.CheckSum);
		//InsertHeaderData(topElement,"DataDirectory",currentFileHeader.OptionalHeader.DataDirectory);
		InsertHeaderData(topElement,"DllCharacteristics",currentFileHeader.OptionalHeader.DllCharacteristics);
		InsertHeaderData(topElement,"FileAlignment",currentFileHeader.OptionalHeader.FileAlignment);
		InsertHeaderData(topElement,"ImageBase",currentFileHeader.OptionalHeader.ImageBase);
		InsertHeaderData(topElement,"LoaderFlags",currentFileHeader.OptionalHeader.LoaderFlags);
		InsertHeaderData(topElement,"Magic",currentFileHeader.OptionalHeader.Magic);
		InsertHeaderData(topElement,"MajorImageVersion",currentFileHeader.OptionalHeader.MajorImageVersion);
		InsertHeaderData(topElement,"MajorLinkerVersion",currentFileHeader.OptionalHeader.MajorLinkerVersion);
		InsertHeaderData(topElement,"MajorOperatingSystemVersion",currentFileHeader.OptionalHeader.MajorOperatingSystemVersion);
		InsertHeaderData(topElement,"MajorSubsystemVersion",currentFileHeader.OptionalHeader.MajorSubsystemVersion);
		InsertHeaderData(topElement,"MinorImageVersion",currentFileHeader.OptionalHeader.MinorImageVersion);
		InsertHeaderData(topElement,"MinorLinkerVersion",currentFileHeader.OptionalHeader.MinorLinkerVersion);
		InsertHeaderData(topElement,"MinorOperatingSystemVersion",currentFileHeader.OptionalHeader.MinorOperatingSystemVersion);
		InsertHeaderData(topElement,"MinorSubsystemVersion",currentFileHeader.OptionalHeader.MinorSubsystemVersion);
		InsertHeaderData(topElement,"NumberOfRvaAndSizes",currentFileHeader.OptionalHeader.NumberOfRvaAndSizes);
		InsertHeaderData(topElement,"SectionAlignment",currentFileHeader.OptionalHeader.SectionAlignment);
		InsertHeaderData(topElement,"SizeOfCode",currentFileHeader.OptionalHeader.SizeOfCode);
		InsertHeaderData(topElement,"SizeOfHeaders",currentFileHeader.OptionalHeader.SizeOfHeaders);
		InsertHeaderData(topElement,"SizeOfHeapCommit",currentFileHeader.OptionalHeader.SizeOfHeapCommit);
		InsertHeaderData(topElement,"SizeOfHeapReserve",currentFileHeader.OptionalHeader.SizeOfHeapReserve);
		InsertHeaderData(topElement,"SizeOfImage",currentFileHeader.OptionalHeader.SizeOfImage);
		InsertHeaderData(topElement,"SizeOfInitializedData",currentFileHeader.OptionalHeader.SizeOfInitializedData);
		InsertHeaderData(topElement,"SizeOfStackCommit",currentFileHeader.OptionalHeader.SizeOfStackCommit);
		InsertHeaderData(topElement,"SizeOfStackReserve",currentFileHeader.OptionalHeader.SizeOfStackReserve);
		InsertHeaderData(topElement,"SizeOfUninitializedData",currentFileHeader.OptionalHeader.SizeOfUninitializedData);
		InsertHeaderData(topElement,"Subsystem",currentFileHeader.OptionalHeader.Subsystem);
		InsertHeaderData(topElement,"Win32VersionValue",currentFileHeader.OptionalHeader.Win32VersionValue);
	}
}
开发者ID:blaquee,项目名称:Nanomite,代码行数:79,代码来源:qtDLGPEEditor.cpp

示例12: nameChanged

void EditDrumset::nameChanged(const QString& name)
      {
      QTreeWidgetItem* item = pitchList->currentItem();
      if (item)
            item->setText(COL_NAME, name);
      }
开发者ID:alexkonradi,项目名称:MuseScore,代码行数:6,代码来源:editdrumset.cpp

示例13: a

void
ViewHelpMenu::generalInfo()
{
  std::string text2 = getPGLVersionString();
  QString text;
  ViewSysInfo a (this,__glwidget,(tr("PlantGL Viewer")+" "+QString(text2.c_str())).toAscii(),true);
  QTreeWidgetItem * itemF = a.addItem(tr("PlantGL Library"));
  QTreeWidgetItem *item = new QTreeWidgetItem( itemF );
  item->setText( 0, tr( "Version" ) );
  item->setText( 1, QString(text2.c_str()) );
  item = new QTreeWidgetItem( itemF, item );
  item->setText( 0, tr( "Binary Format Version" ) );
  item->setText( 1, QString::number(BinaryPrinter::BINARY_FORMAT_VERSION) );
  item = new QTreeWidgetItem( itemF, item );
  item->setText( 0, tr( "Real Type Precision" ) );
#ifdef PGL_USE_DOUBLE
  text = "Double";
#else
  text = "Simple";
#endif
  item->setText( 1, text  );
  item = new QTreeWidgetItem( itemF, item );
  item->setText( 0, tr( "Using Threads" ) );
  if(ViewGeomSceneGL::useThread()) text = "True";
  else text = "False";
  item->setText( 1, tr( text.toAscii() ) );

  item = new QTreeWidgetItem( itemF, item );
  item->setText( 0, tr( "PGL Namespace" ) );
#ifndef PGL_NAMESPACE_NAME
  text = "False";
#else
  text = "True";
#endif
  item->setText( 1, tr( text.toAscii() ) );
  item = new QTreeWidgetItem( itemF, item );
  item->setText( 0, tr( "PGL Debug" ) );
#ifdef PGL_DEBUG
  text = "True";
#else
  text = "False";
#endif
  item->setText( 1, tr( text.toAscii() ) );
#ifdef _WIN32
  item = new QTreeWidgetItem( itemF, item );
  item->setText( 0, tr( "PGL DLLs" ) );
#ifdef VIEW_DLL
  text = "True";
#else
  text = "False";
#endif
  item->setText( 1, tr( text.toAscii() ) );
#endif
  item = new QTreeWidgetItem( itemF, item );
  item->setText( 0, tr( "Using Glut" ) );
#ifdef WITH_GLUT
  text = "True";
#else
  text = "False";
#endif
  item->setText( 1, tr( text.toAscii() ) );
  itemF = a.addItem(tr("Tools Library"));
  item = new QTreeWidgetItem( itemF );
  item->setText( 0, tr( "Tools Namespace" ) );
#ifndef TOOLS_NAMESPACE_NAME
  text = "False";
#else
  text = "True";
#endif
  item->setText( 1, tr( text.toAscii() ) );
  //itemF = a.addItem(tr("PlantGL"));
  //item = new QTreeWidgetItem( itemF );
  //item->setText( 0, tr( "Install Path" ) );
  //string p = TOOLS(getPlantGLDir());
  //if(!p.empty())item->setText( 1, QString(p.c_str()) );
  itemF = a.addItem(tr("Flex"));
  item = new QTreeWidgetItem( itemF );
  item->setText( 0, tr( "Version" ) );
  item->setText( 1, QString(lexerVersion().c_str())  );
  a.exec();
}
开发者ID:kkremitzki,项目名称:plantgl,代码行数:81,代码来源:helpmenu.cpp

示例14: init

void DialogMsgManage::init()
{
    setWindowFlags(Qt::Dialog | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
    setAttribute(Qt::WA_DeleteOnClose);
    //加载qss
    QFile file(":/qss/Dialog.qss");
    if (!file.open(QIODevice::ReadOnly)) {
        qDebug() << file.errorString() << __FILE__ << __LINE__;
    } else {
        setStyleSheet(file.readAll());
    }
    file.close();    
    connect(g_msgbox, SIGNAL(signMsgChanged(int,int,int))
            , this, SLOT(slotProcessMsgChange(int,int,int)), Qt::QueuedConnection);
    
    ui->btnFirstPage->setEnabled(false);
    ui->btnPrevPage->setEnabled(false);
    ui->btnNextPage->setEnabled(false);
    ui->btnLastPage->setEnabled(false);

    m_valid.setRange(0, 0);
    ui->lineEditCurPage->setValidator(&m_valid);
    ui->lineEditCurPage->setText("0");
    ui->lineEditCurPage->setAlignment(Qt::AlignCenter);
    ui->labelPageNum->setAlignment(Qt::AlignCenter);
    
    //信息列表菜单
    m_actRead = new QAction(this);
    connect(m_actRead, SIGNAL(triggered()), this, SLOT(slotActionRead()));
    m_actStopRead = new QAction(this);
    connect(m_actStopRead, SIGNAL(triggered()), this, SLOT(slotActionStopRead()));
    m_actForwarding = new QAction(this);
    connect(m_actForwarding, SIGNAL(triggered()), this, SLOT(slotActionForwarding()));
    m_actReply = new QAction(this);
    connect(m_actReply, SIGNAL(triggered()), this, SLOT(slotActionReply()));
//    m_actMoveToInbox = new QAction(this);
//    connect(m_actMoveToInbox, SIGNAL(triggered()), this, SLOT(slotActionMoveToInbox()));
//    m_actMoveToOutbox = new QAction(this);
//    connect(m_actMoveToOutbox, SIGNAL(triggered()), this, SLOT(slotActionMoveToOutbox()));
//    m_actMoveToDraftbox = new QAction(this);
//    connect(m_actMoveToDraftbox, SIGNAL(triggered()), this, SLOT(slotActionMoveToDraftbox()));
//    m_actMoveToDustbin = new QAction(this);
//    connect(m_actMoveToDustbin, SIGNAL(triggered()), this, SLOT(slotActionMoveToDustbin()));
    m_actRestore = new QAction(this);
    connect(m_actRestore, SIGNAL(triggered()), this, SLOT(slotActionRestore()));
    m_actAddIntoPhoneBook = new QAction(this);
    connect(m_actAddIntoPhoneBook, SIGNAL(triggered()), this, SLOT(slotActionAddIntoPhoneBook()));
    m_actDelete = new QAction(this);
    connect(m_actDelete, SIGNAL(triggered()), this, SLOT(slotActionDelete()));
    m_menuMsgList = new QMenu(this);
    m_menuMsgList->addAction(m_actRead);
    m_menuMsgList->addAction(m_actStopRead);
    m_menuMsgList->addAction(m_actForwarding);
    m_menuMsgList->addAction(m_actReply);
    m_menuMsgList->addSeparator();
    m_menuMsgList->addAction(m_actAddIntoPhoneBook);
    m_menuMsgList->addSeparator();
//    m_menuMsgList->addAction(m_actMoveToInbox);
//    m_menuMsgList->addAction(m_actMoveToOutbox);
//    m_menuMsgList->addAction(m_actMoveToDraftbox);
//    m_menuMsgList->addAction(m_actMoveToDustbin);
    m_menuMsgList->addAction(m_actRestore);
    m_menuMsgList->addSeparator();
    m_menuMsgList->addAction(m_actDelete);
    ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
    
    m_actSetAllRead = new QAction(this);
    connect(m_actSetAllRead, SIGNAL(triggered()), this, SLOT(slotActionSetAllRead()));
    m_actViewUnread = new QAction(this);
    connect(m_actViewUnread, SIGNAL(triggered()), this, SLOT(slotActionViewUnread()));
    m_actExport = new QAction(this);
    connect(m_actExport, SIGNAL(triggered()), this, SLOT(slotActionExport()));
    m_actDeleteAll = new QAction(this);
    connect(m_actDeleteAll, SIGNAL(triggered()), this, SLOT(slotActionDeleteAll()));
    m_actDeleteMoreSetting = new QAction(this);
    connect(m_actDeleteMoreSetting, SIGNAL(triggered()), this, SLOT(slotActionDeleteMoreSetting()));
    m_menuTree = new QMenu(this);
    m_menuTree->addAction(m_actViewUnread);
    m_menuTree->addAction(m_actSetAllRead);
    m_menuTree->addSeparator();
    m_menuTree->addAction(m_actExport);
    m_menuTree->addSeparator();
    m_menuTree->addAction(m_actDeleteAll);
    m_menuTree->addAction(m_actDeleteMoreSetting);
    ui->treeWidget->setContextMenuPolicy(Qt::CustomContextMenu);

    ui->treeWidget->header()->hide();
    m_msgBoxTopItem = new QTreeWidgetItem(ui->treeWidget);
    m_msgBoxTopItem->setSizeHint(0, QSize(0, cons_tree_item_height));
    for (int i=0; i<=Message::Box_Dustbin; i++) {
        QTreeWidgetItem *twItem = new QTreeWidgetItem(m_msgBoxTopItem);
        twItem->setData(0, Qt::UserRole + DataIndex_Type, DataType_MessageBox);
        twItem->setData(0, Qt::UserRole + DataIndex_Value, i);
        twItem->setSizeHint(0, QSize(0, cons_tree_item_height));
        m_msgBoxItems << twItem;
    }
    m_phoneBookItem = new QTreeWidgetItem(ui->treeWidget);
    m_phoneBookItem->setSizeHint(0, QSize(0, cons_tree_item_height));
    for (int i=0; i<=Contact::Type_Stranger; i++) {
        QTreeWidgetItem *twItem = new QTreeWidgetItem(m_phoneBookItem);
//.........这里部分代码省略.........
开发者ID:llong283,项目名称:VirtualSMS,代码行数:101,代码来源:dialogmsgmanage.cpp

示例15: pluginTestFinished

void MainWindow::pluginTestFinished(PluginTest *test)
{
	QTreeWidgetItem *item = treeItemFromPluginTest(test);
	//
	if (item != NULL)
	{
		QFont font = item->font(0);
		font.setBold(true);
		// is test ok?
		if (test->isTestOk())
		{
			item->setText(1, "[Ok]");
			item->setFont(1, font);
		}
		else // test failed
		{
			item->setText(1, "[Failed!]");
			item->setFont(0, font);
		}
		// update info
		item->child(2)->child(0)->setText(1, test->getCaption());
		item->child(3)->child(0)->setText(1, test->getFlvUrl());
		item->child(3)->child(1)->child(0)->setText(1, QString("%1").arg(test->getSize()));
		// update info results
		if (!test->isFlvOk())
		{
			item->child(3)->setText(1, "[Failed!]");
			item->child(3)->setFont(0, font);
			// is flvurl empty?
			if (test->getFlvUrl().isEmpty())
			{
				item->child(3)->child(0)->setText(1, "Empty Url!");
				item->child(3)->child(0)->setFont(0, font);
			}
			// is size?
			if (test->getSize() != test->getExpectedSize())
			{
				item->child(3)->child(1)->setText(1,"[Failed!]");
				item->child(3)->child(1)->setFont(0, font);
			}
			else // size ok
			{
				item->child(3)->child(1)->setText(1,"[Ok]");
				item->child(3)->child(1)->setFont(1, font);
			}
		}
		else // flv ok
		{
			// flv
			item->child(3)->setText(1, "[Ok]");
			item->child(3)->setFont(1, font);
			// size flv
			item->child(3)->child(1)->setText(1,"[Ok]");
			item->child(3)->child(1)->setFont(1, font);
		}
		//
		if (!test->isCaptionOk())
		{
			item->child(2)->setText(1, "[Failed!]");
			item->child(2)->setFont(0, font);
		}
		else // caption ok
		{
			item->child(2)->setText(1, "[Ok]");
			item->child(2)->setFont(1, font);
		}
	}
}
开发者ID:Foxofoxes,项目名称:xVideoServiceThief,代码行数:68,代码来源:mainwindow.cpp


注:本文中的QTreeWidgetItem::setText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。