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


C++ setModel函数代码示例

本文整理汇总了C++中setModel函数的典型用法代码示例。如果您正苦于以下问题:C++ setModel函数的具体用法?C++ setModel怎么用?C++ setModel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: QString

void MyMainWindow::start_crypto(int crypto_type)
{
	// check if the password fields match
	if(ui->password_0->text() == ui->password_1->text())
	{
		QString pass = ui->password_0->text();
		QString encrypt_name;

		bool checked = false;

		// make sure that there is actually something selected in the model for cryptography
		for(int n = file_model->rowCount(), i = 0; i < n; i++)
		{
			if(file_model->data(file_model->index(i, MyFileSystemModelPublic::CHECKED_HEADER),
				Qt::CheckStateRole) == Qt::Checked)
			{
				checked = true;
				break;
			}
		}

		// check that the password is long enough
		if(pass.toUtf8().size() < MIN_PASS_LENGTH)
		{
			QString num_text = QString::number(MIN_PASS_LENGTH);
			QString warn_text = QString("The password entered was too short. ") + "Please enter a longer "
			"one (at least " + num_text + " ASCII characters/bytes) before continuing.";

			QMessageBox::warning(this, "Password too short!", warn_text);
		}

		// give the user a warning message if nothing was selected
		else if(!checked)
		{
			QString crypto_text = (crypto_type == START_ENCRYPT) ? "encryption!" : "decryption!";
			QString warn_text = QString("There were no items selected for " + crypto_text);

			QMessageBox::warning(this, "Nothing selected!", warn_text);
		}

		else
		{
			// start the encryption process
			bool delete_success = ui->delete_success->isChecked();

			MyFileSystemModelPtr clone_model(file_model->cloneByValue());

			/*
			MyAbstractBarPtr ptr_mpb = (crypto_type == START_ENCRYPT) ?
				MyAbstractBarPtr(new MyEncryptBar(this, clone_model.get(), pass, delete_success)) :
				MyAbstractBarPtr(new MyDecryptBar(this, clone_model.get(), pass, delete_success));
			*/

			MyAbstractBarPtr ptr_mpb;

			if(crypto_type == START_ENCRYPT)
			{
				// check if the user wants to rename the encrypted files to something else
				if(ui->encrypt_rename->isChecked())
				{
					encrypt_name = ui->encrypt_filename->text();
					ptr_mpb = MyAbstractBarPtr(new MyEncryptBar(this, clone_model.get(), pass, delete_success,
						&encrypt_name));
				}
				else
				{
					ptr_mpb = MyAbstractBarPtr(new MyEncryptBar(this, clone_model.get(), pass,
						delete_success));
				}
			}
			else
				ptr_mpb = MyAbstractBarPtr(new MyDecryptBar(this, clone_model.get(), pass, delete_success));

			if(ptr_mpb != nullptr)
				ptr_mpb->exec();

			// after crypto, replace the old model with the new one
			setModel(clone_model.release());

			// clear the password fields when done
			ui->password_0->clear();
			ui->password_1->clear();
		}
	}
	else
		QMessageBox::warning(this, "Passwords do not match!", "The password fields do not match! "
			"Please make sure they were entered correctly and try again.");
}
开发者ID:trashctor,项目名称:QtCrypt,代码行数:88,代码来源:mymainwindow.cpp

示例2: FoursquareModel

void FoursquarePlugin::initialize()
{
    FoursquareModel *model = new FoursquareModel( marbleModel(), this );
    setModel( model );
    setNumberOfItems( 20 ); // Do we hardcode that?
}
开发者ID:KDE,项目名称:marble,代码行数:6,代码来源:FoursquarePlugin.cpp

示例3: QTreeView

PacketList::PacketList(QWidget *parent) :
    QTreeView(parent),
    proto_tree_(NULL),
    byte_view_tab_(NULL),
    cap_file_(NULL),
    decode_as_(NULL),
    ctx_column_(-1),
    overlay_timer_id_(0),
    create_near_overlay_(true),
    create_far_overlay_(true),
    capture_in_progress_(false),
    tail_timer_id_(0),
    rows_inserted_(false),
    columns_changed_(false),
    set_column_visibility_(false)
{
    QMenu *main_menu_item, *submenu;
    QAction *action;

    setItemsExpandable(false);
    setRootIsDecorated(false);
    setSortingEnabled(true);
    setUniformRowHeights(true);
    setAccessibleName("Packet list");

    overlay_sb_ = new OverlayScrollBar(Qt::Vertical, this);
    setVerticalScrollBar(overlay_sb_);

    packet_list_model_ = new PacketListModel(this, cap_file_);
    setModel(packet_list_model_);
    sortByColumn(-1, Qt::AscendingOrder);

    // XXX We might want to reimplement setParent() and fill in the context
    // menu there.
    ctx_menu_.addAction(window()->findChild<QAction *>("actionEditMarkPacket"));
    ctx_menu_.addAction(window()->findChild<QAction *>("actionEditIgnorePacket"));
    ctx_menu_.addAction(window()->findChild<QAction *>("actionEditSetTimeReference"));
    ctx_menu_.addAction(window()->findChild<QAction *>("actionEditTimeShift"));
    ctx_menu_.addAction(window()->findChild<QAction *>("actionEditPacketComment"));

    ctx_menu_.addSeparator();

    ctx_menu_.addAction(window()->findChild<QAction *>("actionViewEditResolvedName"));
    ctx_menu_.addSeparator();

    main_menu_item = window()->findChild<QMenu *>("menuApplyAsFilter");
    submenu = new QMenu(main_menu_item->title());
    ctx_menu_.addMenu(submenu);
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFNotSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFAndSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFOrSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFAndNotSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFOrNotSelected"));

    main_menu_item = window()->findChild<QMenu *>("menuPrepareAFilter");
    submenu = new QMenu(main_menu_item->title());
    ctx_menu_.addMenu(submenu);
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFNotSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFAndSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFOrSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFAndNotSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFOrNotSelected"));

    const char *conv_menu_name = "menuConversationFilter";
    main_menu_item = window()->findChild<QMenu *>(conv_menu_name);
    conv_menu_.setTitle(main_menu_item->title());
    conv_menu_.setObjectName(conv_menu_name);
    ctx_menu_.addMenu(&conv_menu_);

    const char *colorize_menu_name = "menuColorizeConversation";
    main_menu_item = window()->findChild<QMenu *>(colorize_menu_name);
    colorize_menu_.setTitle(main_menu_item->title());
    colorize_menu_.setObjectName(colorize_menu_name);
    ctx_menu_.addMenu(&colorize_menu_);

    main_menu_item = window()->findChild<QMenu *>("menuSCTP");
    submenu = new QMenu(main_menu_item->title());
    ctx_menu_.addMenu(submenu);
    submenu->addAction(window()->findChild<QAction *>("actionSCTPAnalyseThisAssociation"));
    submenu->addAction(window()->findChild<QAction *>("actionSCTPShowAllAssociations"));
    submenu->addAction(window()->findChild<QAction *>("actionSCTPFilterThisAssociation"));

    main_menu_item = window()->findChild<QMenu *>("menuFollow");
    submenu = new QMenu(main_menu_item->title());
    ctx_menu_.addMenu(submenu);
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzeFollowTCPStream"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzeFollowUDPStream"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzeFollowSSLStream"));

    ctx_menu_.addSeparator();

    main_menu_item = window()->findChild<QMenu *>("menuEditCopy");
    submenu = new QMenu(main_menu_item->title());
    ctx_menu_.addMenu(submenu);

    action = submenu->addAction(tr("Summary as Text"));
    action->setData(copy_summary_text_);
    connect(action, SIGNAL(triggered()), this, SLOT(copySummary()));
//.........这里部分代码省略.........
开发者ID:newbeess,项目名称:wireshark,代码行数:101,代码来源:packet_list.cpp

示例4: parsePartitions


//.........这里部分代码省略.........
	    }
	  if(*ch == ',')
	    {	       
	      ch++;
	      goto numberPairs;
	    }
	}  
      
      assert(0);
       
    parsed:
      i = i;
    }
  
  fclose(f);
 
  /*********************************************************************************************************************/ 

  for(i = 0; i <= rdta->sites; i++)
    tr->model[i] = -1;
  
  for(i = 0; i < numberOfModels; i++)
    {   
      as = partitions[i][0];     
      
      for(j = 0; j < as; j++)
	{
	  lower = partitions[i][1 + j * 3];
	  upper = partitions[i][2 + j * 3]; 
	  modulo = partitions[i][3 + j * 3];	
	 
	  if(modulo == -1)
	    {
	      for(k = lower; k <= upper; k++)
		setModel(i, k, tr->model);
	    }
	  else
	    {
	      for(k = lower; k <= upper; k += modulo)
		{
		  if(k <= rdta->sites)
		    setModel(i, k, tr->model);	      
		}
	    }
	}        
    }


  for(i = 1; i < rdta->sites + 1; i++)
    {
      
      if(tr->model[i] == -1)
	{
	  printf("ERROR: Alignment Position %d has not been assigned any model\n", i);
	  exit(-1);
	}      
    }  

  for(i = 0; i < numberOfModels; i++)
    {
      rax_free(partitions[i]);
      rax_free(p_names[i]);
    }
  
  rax_free(partitions);
  rax_free(p_names);    
    
  tr->NumberOfModels = numberOfModels;     
  
  if(adef->perGeneBranchLengths)
    {
      if(tr->NumberOfModels > NUM_BRANCHES)
	{
	  printf("You are trying to use %d partitioned models for an individual per-gene branch length estimate.\n", tr->NumberOfModels);
	  printf("Currently only a number of %d models/partitions is hard-coded to improve efficiency.\n", NUM_BRANCHES);
	  printf("\n");
	  printf("In order to change this please replace the line \"#define NUM_BRANCHES   %d\" in file \"axml.h\" \n", NUM_BRANCHES);
	  printf("by \"#define NUM_BRANCHES   %d\" and then re-compile RAxML.\n", tr->NumberOfModels);
	  exit(-1);
	}
      else
	{	  
	  if(tr->NumberOfModels != NUM_BRANCHES)
	    {
	      printf("\nWarning: for better performance under this partition scheme replace the line \"#define NUM_BRANCHES   %d\" in file \"axml.h\" \n", NUM_BRANCHES);
	      printf("by \"#define NUM_BRANCHES   %d\" and then re-compile RAxML.\n", tr->NumberOfModels);
	    }

	  tr->numBranches = tr->NumberOfModels;
	}
    }
  else
    {
       if(tr->NumberOfModels < NUM_BRANCHES)
	 {
	     printf("\nWarning: for better performance under this partition scheme  replace the line \"#define NUM_BRANCHES   %d\" in file \"axml.h\" \n", NUM_BRANCHES);
	     printf("by \"#define NUM_BRANCHES   %d\" and then re-compile RAxML.\n", 1);
	 }
    }
}
开发者ID:KhaosResearch,项目名称:MORPHY,代码行数:101,代码来源:parsePartitions.c

示例5: QFEnhancedComboBox

QFPseudoTreeModelEnhancedComboBox::QFPseudoTreeModelEnhancedComboBox(QWidget *parent):
    QFEnhancedComboBox(parent)
{
    m_model=new QFPseudoTreeModel(this);
    setModel(m_model);
}
开发者ID:jkriege2,项目名称:QuickFit3,代码行数:6,代码来源:qfpseudotreemodel.cpp

示例6: QListView

Playlist::PrettyListView::PrettyListView( QWidget* parent )
        : QListView( parent )
        , ViewCommon()
        , m_headerPressIndex( QModelIndex() )
        , m_mousePressInHeader( false )
        , m_skipAutoScroll( false )
        , m_firstScrollToActiveTrack( true )
        , m_rowsInsertedScrollItem( 0 )
        , m_showOnlyMatches( false )
        , m_pd( 0 )
{
    // QAbstractItemView basics
    setModel( The::playlist()->qaim() );

    m_prettyDelegate = new PrettyItemDelegate( this );
    connect( m_prettyDelegate, SIGNAL( redrawRequested() ), this, SLOT( redrawActive() ) );
    setItemDelegate( m_prettyDelegate );

    setSelectionMode( ExtendedSelection );
    setDragDropMode( DragDrop );
    setDropIndicatorShown( false ); // we draw our own drop indicator
    setEditTriggers ( SelectedClicked | EditKeyPressed );
    setAutoScroll( true );

    setVerticalScrollMode( ScrollPerPixel );

    setMouseTracking( true );

    // Rendering adjustments
    setFrameShape( QFrame::NoFrame );
    setAlternatingRowColors( true) ;
    The::paletteHandler()->updateItemView( this );
    connect( The::paletteHandler(), SIGNAL(newPalette(QPalette)), SLOT(newPalette(QPalette)) );

    setAutoFillBackground( false );


    // Signal connections
    connect( this, SIGNAL(doubleClicked(QModelIndex)),
             this, SLOT(trackActivated(QModelIndex)) );
    connect( selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
             this, SLOT(slotSelectionChanged()) );

    connect( LayoutManager::instance(), SIGNAL(activeLayoutChanged()), this, SLOT(playlistLayoutChanged()) );

    connect( model(), SIGNAL(activeTrackChanged(quint64)), this, SLOT(slotPlaylistActiveTrackChanged()) );

    connect( model(), SIGNAL(queueChanged()), viewport(), SLOT(update()) );

    //   Warning, this one doesn't connect to the normal 'model()' (i.e. '->top()'), but to '->bottom()'.
    connect( Playlist::ModelStack::instance()->bottom(), SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(bottomModelRowsInserted(QModelIndex,int,int)) );

    // Timers
    m_proxyUpdateTimer = new QTimer( this );
    m_proxyUpdateTimer->setSingleShot( true );
    connect( m_proxyUpdateTimer, SIGNAL(timeout()), this, SLOT(updateProxyTimeout()) );

    m_animationTimer = new QTimer(this);
    connect( m_animationTimer, SIGNAL(timeout()), this, SLOT(redrawActive()) );
    m_animationTimer->setInterval( 250 );

    playlistLayoutChanged();

    // We do the following call here to be formally correct, but note:
    //   - It happens to be redundant, because 'playlistLayoutChanged()' already schedules
    //     another one, via a QTimer( 0 ).
    //   - Both that one and this one don't work right (they scroll like 'PositionAtTop',
    //     not 'PositionAtCenter'). This is probably because MainWindow changes its
    //     geometry in a QTimer( 0 )? As a fix, MainWindow does a 'slotShowActiveTrack()'
    //     at the end of its QTimer slot, which will finally scroll to the right spot.
    slotPlaylistActiveTrackChanged();
}
开发者ID:cancamilo,项目名称:amarok,代码行数:72,代码来源:PrettyListView.cpp

示例7: setModel

MenuBarComponent::~MenuBarComponent()
{
    setModel (nullptr);
    Desktop::getInstance().removeGlobalMouseListener (this);
}
开发者ID:anthonyhuecouret,项目名称:argotlunar,代码行数:5,代码来源:juce_MenuBarComponent.cpp

示例8: setModel

void PacketList::thaw()
{
    setModel(packet_list_model_);
    setUpdatesEnabled(true);
    setColumnVisibility();
}
开发者ID:ARK1988,项目名称:wireshark,代码行数:6,代码来源:packet_list.cpp

示例9: QStandardItem

void ConfigBitsView::SetDevice(Device* newDevice, DeviceData* newDeviceData)
{
    int i, j;

    device = newDevice;
    deviceData = newDeviceData;

    model.clear();
    model.setHorizontalHeaderItem(0, new QStandardItem("Description"));
    model.setHorizontalHeaderItem(1, new QStandardItem("Setting"));
    QList<QStandardItem*> row;
    Device::ConfigWord* word;
    unsigned int* wordValue;
    unsigned int* wordVerify;
    Device::ConfigField* field;
    ConfigBitsItem* item;

    for(i = 0; i < device->configWords.count(); i++)
    {
        word = &device->configWords[i];
        wordValue = deviceData->ConfigWordPointer(word->address);

        if(verifyData != NULL)
        {
            wordVerify = verifyData->ConfigWordPointer(word->address);
        }
        else
        {
            wordVerify = NULL;
        }

        item = new ConfigBitsItem(device, word, wordValue);
        for(j = 0; j < word->fields.count(); j++)
        {
            field = &word->fields[j];

            row.append(new ConfigBitsItem(device, field->description));
            row.append(new ConfigBitsItem(device, field, word, wordValue, wordVerify));
            item->appendRow(row);
            row.clear();
        }

        row.append(item);
        if(wordVerify != NULL)
        {
            row.append(new ConfigBitsItem(device, word, wordValue, wordVerify));
        }
        else
        {
            row.append(new ConfigBitsItem(device, wordValue));
        }
        model.appendRow(row);
        row.clear();
    }

    setModel(&model);
    setItemDelegate(new ConfigBitsDelegate(&model));
    setEditTriggers(QAbstractItemView::CurrentChanged);
    setWordWrap(true);
    setRootIsDecorated(false);
    setUniformRowHeights(true);
    setDragDropMode(QAbstractItemView::NoDragDrop);

    expandAll();
    setItemsExpandable(false);
    if(columnSplit)
    {
        setColumnWidth(0, columnSplit);
    }
    else
    {
        resizeColumnToContents(0);
    }
}
开发者ID:lamotriz,项目名称:motor-esferico,代码行数:74,代码来源:ConfigBitsView.cpp

示例10: QTreeView

PacketList::PacketList(QWidget *parent) :
    QTreeView(parent),
    proto_tree_(NULL),
    byte_view_tab_(NULL),
    cap_file_(NULL),
    decode_as_(NULL),
    ctx_column_(-1)
{
    QMenu *submenu, *subsubmenu;
    QAction *action;

    setItemsExpandable(false);
    setRootIsDecorated(false);
    setSortingEnabled(true);
    setUniformRowHeights(true);
    setAccessibleName("Packet list");
    setItemDelegateForColumn(0, &related_packet_delegate_);

    packet_list_model_ = new PacketListModel(this, cap_file_);
    setModel(packet_list_model_);
    sortByColumn(-1, Qt::AscendingOrder);

    // XXX We might want to reimplement setParent() and fill in the context
    // menu there.
    ctx_menu_.addAction(window()->findChild<QAction *>("actionEditMarkPacket"));
    ctx_menu_.addAction(window()->findChild<QAction *>("actionEditIgnorePacket"));
    ctx_menu_.addAction(window()->findChild<QAction *>("actionEditSetTimeReference"));
    ctx_menu_.addAction(window()->findChild<QAction *>("actionEditTimeShift"));
    ctx_menu_.addAction(window()->findChild<QAction *>("actionEditPacketComment"));

    ctx_menu_.addSeparator();

    action = window()->findChild<QAction *>("actionFollow");
    submenu = new QMenu();
    action->setMenu(submenu);
    ctx_menu_.addAction(action);
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzeFollowTCPStream"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzeFollowUDPStream"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzeFollowSSLStream"));

    action = window()->findChild<QAction *>("actionSCTP");
    submenu = new QMenu();
    action->setMenu(submenu);
    ctx_menu_.addAction(action);
    ctx_menu_.addMenu(submenu);
    submenu->addAction(window()->findChild<QAction *>("actionSCTPAnalyseThisAssociation"));
    submenu->addAction(window()->findChild<QAction *>("actionSCTPShowAllAssociations"));
    submenu->addAction(window()->findChild<QAction *>("actionSCTPFilterThisAssociation"));

    ctx_menu_.addSeparator();

//    "     <menuitem name='ManuallyResolveAddress' action='/ManuallyResolveAddress'/>\n"
//    ctx_menu_.addSeparator();

    action = window()->findChild<QAction *>("actionApply_as_Filter");
    submenu = new QMenu();
    action->setMenu(submenu);
    ctx_menu_.addAction(action);
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFNotSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFAndSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFOrSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFAndNotSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFOrNotSelected"));

    action = window()->findChild<QAction *>("actionPrepare_a_Filter");
    submenu = new QMenu();
    action->setMenu(submenu);
    ctx_menu_.addAction(action);
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFNotSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFAndSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFOrSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFAndNotSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFOrNotSelected"));

//    action = window()->findChild<QAction *>("actionColorize_with_Filter");
//    submenu = new QMenu();
//    action->setMenu(submenu);
//    ctx_menu_.addAction(action);
//    "     <menu name= 'ConversationFilter' action='/Conversation Filter'>\n"
//    "       <menuitem name='Ethernet' action='/Conversation Filter/Ethernet'/>\n"
//    "       <menuitem name='IP' action='/Conversation Filter/IP'/>\n"
//    "       <menuitem name='TCP' action='/Conversation Filter/TCP'/>\n"
//    "       <menuitem name='UDP' action='/Conversation Filter/UDP'/>\n"
//    "       <menuitem name='PN-CBA' action='/Conversation Filter/PN-CBA'/>\n"
//    "     <menu name= 'ColorizeConversation' action='/Colorize Conversation'>\n"
//    "        <menu name= 'Ethernet' action='/Colorize Conversation/Ethernet'>\n"
//    "          <menuitem name='Color1' action='/Colorize Conversation/Ethernet/Color 1'/>\n"
//    "          <menuitem name='Color2' action='/Colorize Conversation/Ethernet/Color 2'/>\n"
//    "          <menuitem name='Color3' action='/Colorize Conversation/Ethernet/Color 3'/>\n"
//    "          <menuitem name='Color4' action='/Colorize Conversation/Ethernet/Color 4'/>\n"
//    "          <menuitem name='Color5' action='/Colorize Conversation/Ethernet/Color 5'/>\n"
//    "          <menuitem name='Color6' action='/Colorize Conversation/Ethernet/Color 6'/>\n"
//    "          <menuitem name='Color7' action='/Colorize Conversation/Ethernet/Color 7'/>\n"
//    "          <menuitem name='Color8' action='/Colorize Conversation/Ethernet/Color 8'/>\n"
//    "          <menuitem name='Color9' action='/Colorize Conversation/Ethernet/Color 9'/>\n"
//    "          <menuitem name='Color10' action='/Colorize Conversation/Ethernet/Color 10'/>\n"
//    "          <menuitem name='NewColoringRule' action='/Colorize Conversation/Ethernet/New Coloring Rule'/>\n"
//    "        <menu name= 'IP' action='/Colorize Conversation/IP'>\n"
//.........这里部分代码省略.........
开发者ID:ARK1988,项目名称:wireshark,代码行数:101,代码来源:packet_list.cpp

示例11: setUpdatesEnabled

void PacketList::freeze()
{
    setUpdatesEnabled(false);
    setModel(NULL);
}
开发者ID:ARK1988,项目名称:wireshark,代码行数:5,代码来源:packet_list.cpp

示例12: setAttributes

HeavyArmor::HeavyArmor(string name, SyukatsuGame *game, Field *field, int _level)
  :Character(name, game, field, _level)
{
  setAttributes(Information::Enemies::HEAVYARMOR); 
  setModel(Assets::enemies[Information::HEAVYARMOR]);
}
开发者ID:rennone,项目名称:SyukatsuDefender,代码行数:6,代码来源:HeavyArmor.cpp

示例13: MyFileInfo

void MyMainWindow::on_delete_checked_clicked()
{
	std::vector<MyFileInfoPtr> item_list;

	// get a list of all the items checked for deletion
	for(int n = file_model->rowCount(), i = 0; i < n; i++)
	{
		if(file_model->data(file_model->index(i, MyFileSystemModelPublic::CHECKED_HEADER),
			Qt::CheckStateRole) == Qt::Checked)
		{
			QString full_path = file_model->data(file_model->index(i,
				MyFileSystemModelPublic::FULL_PATH_HEADER)).toString();
			item_list.push_back(MyFileInfoPtr(new MyFileInfo(nullptr, full_path)));
		}
	}

	int total_items = item_list.size();

	if(total_items != 0)
	{
		QMessageBox::StandardButton ret_val = QMessageBox::question(this, "Delete items?", "Are you "
			"sure you wish to permanently delete the selected items?", QMessageBox::Ok |
			QMessageBox::Cancel, QMessageBox::Cancel);

		if(ret_val == QMessageBox::Ok)
		{
			std::vector<QString> result_list;

			for(int i = 0; i < total_items; i++)
			{
				QString full_path = item_list[i]->getFullPath();
				QString item_type = item_list[i]->getType();

				if(item_type == MyFileInfo::typeToString(MyFileInfoPublic::MFIT_FILE))
				{
					if(QFile::remove(full_path))
					{
						file_model->removeItem(full_path);
						result_list.push_back("Successfully deleted file!");
					}
					else
						result_list.push_back("Error deleting file!");
				}
				else if(item_type == MyFileInfo::typeToString(MyFileInfoPublic::MFIT_DIR))
				{
					if(QDir(full_path).removeRecursively())
					{
						file_model->removeItem(full_path);
						result_list.push_back("Successfully deleted directory!");
					}
					else
						result_list.push_back("Error deleting directory!");
				}
				else
				{
					file_model->removeItem(full_path);
					result_list.push_back("Item was not found!");
				}
			}

			// items were most likely removed from the model, resize columns
			setModel(file_model);

			QString det_string;

			// create a string containing the list of items and results
			for(int i = 0; i < item_list.size(); i++)
			{
				det_string += item_list[i]->getFullPath();
				det_string += "\n" + result_list[i];

				if(i < item_list.size() - 1)
					det_string += "\n\n";
			}

			QMessageBox del_msg(QMessageBox::Information, "Deletion completed!", "The deletion process "
				"was completed. Click below to show details.", QMessageBox::Close, this);

			del_msg.setDetailedText(det_string);
			del_msg.exec();
		}

		// total_items != 0
	}
}
开发者ID:trashctor,项目名称:QtCrypt,代码行数:85,代码来源:mymainwindow.cpp

示例14: QWidget


//.........这里部分代码省略.........
	m_panningKnob = new knob( knobBright_26, NULL, tr( "Panning" ) );
	m_panningKnob->setHintText( tr( "Panning:" ) + " ", "" );
	m_panningKnob->setLabel( tr( "PAN" ) );

	basicControlsLayout->addWidget( m_panningKnob );
	basicControlsLayout->addStretch();

	// set up pitch knob
	m_pitchKnob = new knob( knobBright_26, NULL, tr( "Pitch" ) );
	m_pitchKnob->setHintText( tr( "Pitch:" ) + " ", " " + tr( "cents" ) );
	m_pitchKnob->setLabel( tr( "PITCH" ) );

	basicControlsLayout->addWidget( m_pitchKnob );

	// set up pitch range knob
	m_pitchRangeSpinBox= new LcdSpinBox( 2, NULL, tr( "Pitch range (semitones)" ) );
	m_pitchRangeSpinBox->setLabel( tr( "RANGE" ) );

	basicControlsLayout->addWidget( m_pitchRangeSpinBox );
	basicControlsLayout->addStretch();

	// setup spinbox for selecting FX-channel
	m_effectChannelNumber = new fxLineLcdSpinBox( 2, NULL, tr( "FX channel" ) );
	m_effectChannelNumber->setLabel( tr( "FX" ) );

	basicControlsLayout->addWidget( m_effectChannelNumber );

	basicControlsLayout->addStretch();


	QPushButton* saveSettingsBtn = new QPushButton( embed::getIconPixmap( "project_save" ), QString() );
	saveSettingsBtn->setMinimumSize( 32, 32 );

	connect( saveSettingsBtn, SIGNAL( clicked() ), this, SLOT( saveSettingsBtnClicked() ) );

	toolTip::add( saveSettingsBtn, tr( "Save current channel settings in a preset-file" ) );
	saveSettingsBtn->setWhatsThis(
		tr( "Click here, if you want to save current channel settings "
			"in a preset-file. Later you can load this preset by "
			"double-clicking it in the preset-browser." ) );

	basicControlsLayout->addWidget( saveSettingsBtn );

	generalSettingsLayout->addLayout( basicControlsLayout );


	m_tabWidget = new tabWidget( "", this );
	m_tabWidget->setFixedHeight( INSTRUMENT_HEIGHT + 10 );


	// create tab-widgets
	m_ssView = new InstrumentSoundShapingView( m_tabWidget );

	// FUNC tab
	QWidget* instrumentFunctions = new QWidget( m_tabWidget );
	QVBoxLayout* instrumentFunctionsLayout = new QVBoxLayout( instrumentFunctions );
	instrumentFunctionsLayout->setMargin( 5 );
	m_noteStackingView = new InstrumentFunctionNoteStackingView( &m_track->m_noteStacking );
	m_arpeggioView = new InstrumentFunctionArpeggioView( &m_track->m_arpeggio );

	instrumentFunctionsLayout->addWidget( m_noteStackingView );
	instrumentFunctionsLayout->addWidget( m_arpeggioView );
	instrumentFunctionsLayout->addStretch();

	// MIDI tab
	m_midiView = new InstrumentMidiIOView( m_tabWidget );

	// FX tab
	m_effectView = new EffectRackView( m_track->m_audioPort.effects(), m_tabWidget );

	m_tabWidget->addTab( m_ssView, tr( "ENV/LFO" ), 1 );
	m_tabWidget->addTab( instrumentFunctions, tr( "FUNC" ), 2 );
	m_tabWidget->addTab( m_effectView, tr( "FX" ), 3 );
	m_tabWidget->addTab( m_midiView, tr( "MIDI" ), 4 );

	// setup piano-widget
	m_pianoView = new PianoView( this );
	m_pianoView->setFixedSize( INSTRUMENT_WIDTH, PIANO_HEIGHT );

	vlayout->addWidget( generalSettingsWidget );
	vlayout->addWidget( m_tabWidget );
	vlayout->addWidget( m_pianoView );


	setModel( _itv->model() );

	updateInstrumentView();

	setFixedWidth( INSTRUMENT_WIDTH );
	resize( sizeHint() );

	QMdiSubWindow * subWin = engine::mainWindow()->workspace()->addSubWindow( this );
	Qt::WindowFlags flags = subWin->windowFlags();
	flags |= Qt::MSWindowsFixedSizeDialogHint;
	flags &= ~Qt::WindowMaximizeButtonHint;
	subWin->setWindowFlags( flags );
	subWin->setWindowIcon( embed::getIconPixmap( "instrument_track" ) );
	subWin->setFixedSize( subWin->size() );
	subWin->hide();
}
开发者ID:Cubiicle,项目名称:lmms,代码行数:101,代码来源:InstrumentTrack.cpp

示例15: QVBoxLayout

void LayerTreeSidebar::createForms()
{
	QVBoxLayout *mainLayout = new QVBoxLayout();
	mainLayout->setSpacing(0);
	mainLayout->setContentsMargins(0, 0, 0, 0);
	
	{
		auto view = new QTreeView();
		
		if (d->uiController)
			view->setItemDelegate(new LayerModelViewDelegate(d->uiController, this));
		
		view->setHeaderHidden(true);
		view->setSelectionMode(QAbstractItemView::ExtendedSelection);
		view->setDragDropMode(QAbstractItemView::DragDrop);
		view->setDefaultDropAction(Qt::MoveAction);
		view->setDropIndicatorShown(true);
		
		if (d->document)
		{
			view->setModel(d->document->layerScene()->itemModel());
			view->setSelectionModel(d->document->layerScene()->itemSelectionModel());
			connect(d->document->layerScene(), SIGNAL(thumbnailsUpdated(QPointSet)), view, SLOT(update()));
		}
		
		view->setContextMenuPolicy(Qt::CustomContextMenu);
		connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showViewContextMenu(QPoint)));
		view->installEventFilter(this);
		
		d->view = view;
		
		mainLayout->addWidget(view);
	}
	
	{
		auto lowerLayout = new QVBoxLayout();
		lowerLayout->setSpacing(6);
		lowerLayout->setContentsMargins(6,6,6,6);
		
		{
			auto editor = new LayerPropertyEditor(d->document ? d->document->layerScene() : 0);
			lowerLayout->addWidget(editor);
		}
		
		// buttons
		{
			auto layout = new QHBoxLayout();
			layout->setSpacing(0);
			
			auto addButton = new SimpleButton(":/icons/16x16/add.svg", QSize(16,16));
			addButton->setMargins(4, 0, 4, 0);
			auto removeButton = new SimpleButton(":/icons/16x16/subtract.svg", QSize(16,16));
			removeButton->setMargins(4, 0, 4, 0);
			auto miscButton = new SimpleButton(":/icons/16x16/menuDown.svg", QSize(16,16));
			miscButton->setMargins(4, 0, 4, 0);
			
			if (d->uiController)
			{
				auto addMenu = new QMenu(this);
				
				addMenu->addAction(d->uiController->action(LayerUIController::ActionNewRaster));
				addMenu->addAction(d->uiController->action(LayerUIController::ActionNewGroup));
				addMenu->addAction(d->uiController->action(LayerUIController::ActionImport));
				
				addButton->setMenu(addMenu);
				
				connect(removeButton, SIGNAL(pressed()), d->uiController, SLOT(removeLayers()));
				
				QMenu *miscMenu = new QMenu(this);
				miscMenu->addAction(d->uiController->action(LayerUIController::ActionMerge));
				
				miscButton->setMenu(miscMenu);
			}
			
			layout->addWidget(addButton);
			layout->addWidget(removeButton);
			layout->addWidget(miscButton);
			layout->addStretch(1);
			
			lowerLayout->addLayout(layout);
		}
		
		mainLayout->addLayout(lowerLayout);
	}
	
	setLayout(mainLayout);
}
开发者ID:pasberth,项目名称:PaintField,代码行数:87,代码来源:layertreesidebar.cpp


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