コード例 #1
0
QLayoutItem *QGridLayoutProto::takeAt(int index)
{
  QGridLayout *item = qscriptvalue_cast<QGridLayout*>(thisObject());
  if (item)
    return item->takeAt(index);
  return 0;
}
コード例 #2
0
void QMwMaterialLayersWidget::UpdateLayersPanel()
{
    QGridLayout *layersLayout = (QGridLayout*)this->layersWidget->layout();

    QLayoutItem *child;
    while ((child = layersLayout->takeAt(0)) != 0)
    {
        delete child->widget();
        delete child;
    }

    if (this->material == 0)
        return;

    for (int layerIndex = 0; layerIndex < this->material->shaderSlots.count; layerIndex++)
    {
        QRadioButton *layerSelectRadioButton = new QRadioButton(this->layersWidget);
        layerSelectRadioButton->setChecked(layerIndex == this->selectedLayerIndex);
        layerSelectRadioButton->setProperty("layerIndex", QVariant(layerIndex));
        layerSelectRadioButton->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
        QObject::connect(layerSelectRadioButton, SIGNAL(clicked()), this, SLOT(LayerSelected()));
        layersLayout->addWidget(layerSelectRadioButton, layerIndex, 0);

        QComboBox *shaderOpComboBox = new QComboBox(this->layersWidget);
        this->SetShaderOpComboBox(shaderOpComboBox, layerIndex);
        QObject::connect(shaderOpComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(LayerShaderOperationChanged(int)));
        layersLayout->addWidget(shaderOpComboBox, layerIndex, 1);

        QComboBox *colorOpComboBox = new QComboBox(this->layersWidget);
        this->SetColorOpComboBox(colorOpComboBox, layerIndex);
        QObject::connect(colorOpComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(LayerColorOperationChanged(int)));
        layersLayout->addWidget(colorOpComboBox, layerIndex, 2);
    }
}
コード例 #3
0
ファイル: view.hpp プロジェクト: mbouzid/mvc_qt_calculator
		~view()
		{
			QLayoutItem * childOp, *childNum, *childBox;
			
			while ((childOp = m_grid_operators->takeAt(0)) != 0) 
			{
   				delete childOp;
   			}
   			

   			
   			while ((childNum = m_grid_numpad->takeAt(0)) != 0) 
			{
   				delete childNum;
   			}
   			

   			while ((childBox = m_box->takeAt(0)) != 0) 
			{
   				delete childBox;
   			}
		}
コード例 #4
0
void QxtConfirmationMessagePrivate::init(const QString& message)
{
    remember = false;
    confirm = new QCheckBox(&qxt_p());
    if (!message.isNull())
        confirm->setText(message);
    else
        confirm->setText(QxtConfirmationMessage::tr("Do not show again."));

    QGridLayout* grid = qobject_cast<QGridLayout*>(qxt_p().layout());
    QDialogButtonBox* buttons = qFindChild<QDialogButtonBox*>(&qxt_p());
    if (grid && buttons)
    {
        const int idx = grid->indexOf(buttons);
        int row, column, rowSpan, columnSpan = 0;
        grid->getItemPosition(idx, &row, &column, &rowSpan, &columnSpan);
        QLayoutItem* buttonsItem = grid->takeAt(idx);
        grid->addWidget(confirm, row, column, rowSpan, columnSpan, Qt::AlignLeft | Qt::AlignTop);
        grid->addItem(buttonsItem, ++row, column, rowSpan, columnSpan);
    }
}
コード例 #5
0
ファイル: systray.cpp プロジェクト: nihui/kuaide
void SysTray::updateLayout()
{
    QGridLayout* trayLayout = dynamic_cast<QGridLayout*>(layout());
    /// clear layout
    QLayoutItem* child;
    while ( ( child = trayLayout->takeAt( 0 ) ) != 0 ) {
        ;
    }
    /// add childs
    int trayCount = SysTrayWidgetList.size();
    int rows = qMax( height() / 22, 1 );
    int cols = trayCount / rows + ( ( trayCount % rows > 0 ) ? 1 : 0 );
//     qWarning() << trayCount << rows << cols;
    int r = 0;
    int c = 0;
    foreach (SysTrayWidget* w, SysTrayWidgetList) {
        trayLayout->addWidget( w, r, c );
        if ( ++c == cols ) {
            c = 0;
            ++r;
        }
    }
コード例 #6
0
void ModalitySelectionView::redrawGUI()
{
    m_qListModalityCheckBox.clear();

    //Delete all widgets in the averages layout
    QGridLayout* topLayout = static_cast<QGridLayout*>(this->layout());
    if(!topLayout) {
       topLayout = new QGridLayout();
    }

    QLayoutItem *child;
    while ((child = topLayout->takeAt(0)) != 0) {
        delete child->widget();
        delete child;
    }

    QMapIterator<QString, bool> i(m_modalityMap);

    int count = 0;
    while (i.hasNext()) {
        i.next();

        if(m_lChannelTypeList.contains(i.key(), Qt::CaseInsensitive)) {
            QCheckBox* t_pCheckBoxModality = new QCheckBox(i.key());
            t_pCheckBoxModality->setChecked(i.value());
            m_qListModalityCheckBox << t_pCheckBoxModality;
            connect(t_pCheckBoxModality,&QCheckBox::stateChanged,
                    this, &ModalitySelectionView::onUpdateModalityCheckbox);
            topLayout->addWidget(t_pCheckBoxModality,count,0);
            count++;
        }
    }

    //Find Modalities tab and add current layout
    this->setLayout(topLayout);
}
コード例 #7
0
void PlaylistTabBar::Close() {
  if (menu_index_ == -1) return;

  const int playlist_id = tabData(menu_index_).toInt();

  const int active_id = manager_->active_id();

  qLog(Debug) << "Close : active_id = " << active_id << " and playlist_id = " << playlist_id;


  QSettings s;
  s.beginGroup(kSettingsGroup);

  const bool ask_for_delete = s.value("warn_close_playlist", true).toBool();

  bool check_delete = (ask_for_delete && !manager_->IsPlaylistFavorite(playlist_id) &&
        !manager_->playlist(playlist_id)->GetAllSongs().empty());

  bool check_active = (active_id == playlist_id && manager_->app()->player_locked_);

  qLog(Debug) << "Close : check_delete = " << check_delete << " and check_active = " << check_active;

  if (check_delete || check_active) {

    QMessageBox confirmation_box;
    confirmation_box.setWindowIcon(QIcon(":/icon.png"));
    confirmation_box.setWindowTitle(tr("Remove playlist"));
    confirmation_box.setIcon(QMessageBox::Question);
    confirmation_box.setText(
        tr("You are about to remove a playlist which is not part of your "
           "favorite playlists: "
           "the playlist will be deleted (this action cannot be undone). \n"
           "Are you sure you want to continue?"));
    confirmation_box.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);

    QCheckBox dont_prompt_again(tr("Warn me when closing a playlist tab"),
                                &confirmation_box);
    dont_prompt_again.setChecked(ask_for_delete);
    dont_prompt_again.blockSignals(true);
    dont_prompt_again.setToolTip(
        tr("This option can be changed in the \"Behavior\" preferences"));

    QGridLayout* grid = qobject_cast<QGridLayout*>(confirmation_box.layout());
    QDialogButtonBox* buttons = confirmation_box.findChild<QDialogButtonBox*>();
    if (grid && buttons) {
      const int index = grid->indexOf(buttons);
      int row, column, row_span, column_span = 0;
      grid->getItemPosition(index, &row, &column, &row_span, &column_span);
      QLayoutItem* buttonsItem = grid->takeAt(index);
      grid->addWidget(&dont_prompt_again, row, column, row_span, column_span,
                      Qt::AlignLeft | Qt::AlignTop);
      grid->addItem(buttonsItem, ++row, column, row_span, column_span);
    } else {
      confirmation_box.addButton(&dont_prompt_again, QMessageBox::ActionRole);
    }

    if (confirmation_box.exec() != QMessageBox::Yes) {
      return;
    }

    // If user changed the pref, save the new one
    if (dont_prompt_again.isChecked() != ask_for_delete) {
      s.setValue("warn_close_playlist", dont_prompt_again.isChecked());
    }
  }

  // Close the playlist. If the playlist is not a favorite playlist, it will be
  // deleted, as it will not be visible after being closed. Otherwise, the tab
  // is closed but the playlist still exists and can be resurrected from the
  // "Playlists" tab.
  emit Close(playlist_id);

  // Select the nearest tab.
  if (menu_index_ > 1) {
    setCurrentIndex(menu_index_ - 1);
  }

  // Update playlist tab order/visibility
  TabMoved();
}