Пример #1
2
// Constructor.
patchesDialog::patchesDialog( QWidget *pParent, Qt::WindowFlags wflags )
    : QDialog( pParent, wflags )
{
    // Setup UI struct...
    setupUi( this );

    m_pSynth = NULL;
    m_iChan  = 0;
    m_iBank  = 0;
    m_iProg  = 0;

    // Soundfonts list view...
    QHeaderView *pHeader = m_progListView->header();
//	pHeader->setResizeMode(QHeaderView::Custom);
    pHeader->setDefaultAlignment(Qt::AlignLeft);
//	pHeader->setDefaultSectionSize(200);
#if QT_VERSION >= 0x050000
    pHeader->setSectionsMovable(false);
#else
    pHeader->setMovable(false);
#endif
    pHeader->setStretchLastSection(true);

    m_progListView->resizeColumnToContents(0);	// Prog.
    //pHeader->resizeSection(1, 200);					// Name.

    // Initial sort order...
    m_bankListView->sortItems(0, Qt::AscendingOrder);
    m_progListView->sortItems(0, Qt::AscendingOrder);

    // UI connections...
    QObject::connect(m_bankListView,
                     SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
                     SLOT(bankChanged()));
    QObject::connect(m_progListView,
                     SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
                     SLOT(progChanged(QTreeWidgetItem*,QTreeWidgetItem*)));
    QObject::connect(m_progListView,
                     SIGNAL(itemActivated(QTreeWidgetItem*,int)),
                     SLOT(accept()));
    QObject::connect(m_okButton,
                     SIGNAL(clicked()),
                     SLOT(accept()));
    QObject::connect(m_cancelButton,
                     SIGNAL(clicked()),
                     SLOT(reject()));
}
Пример #2
0
BoardView::BoardView(QWidget *parent)
        :QTableView(parent)
{
	QHeaderView *hHeader = horizontalHeader();
	hHeader->setResizeMode(QHeaderView::Fixed);
	hHeader->setDefaultAlignment( Qt::AlignHCenter );
	hHeader->setDefaultSectionSize(50);
	hHeader->setClickable(false);
	hHeader->setMovable(false);

	QHeaderView *vHeader = verticalHeader();
	vHeader->setResizeMode(QHeaderView::Fixed);
	vHeader->setDefaultAlignment( Qt::AlignVCenter );
	vHeader->setDefaultSectionSize(50);
	vHeader->setClickable(false);
	vHeader->setMovable(false);

	setSelectionMode(QAbstractItemView::SingleSelection);
	setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

	setItemDelegate(new BoardDelegate(this));

	setStyleSheet("QHeaderView::section {background-color: #ffffe7; border: 1px solid #74440e; color: black;  }"
		      "QTableCornerButton::section { background-color: #ffffe7; border: 1px solid #74440e; color: black;  }"
		      "QToolTip { background-color: #ffeeaf; padding: 2px; border: 1px solid #74440e; }");
}
Пример #3
0
DlgFilletEdges::DlgFilletEdges(Part::FilletBase* fillet, QWidget* parent, Qt::WFlags fl)
  : QWidget(parent, fl), ui(new Ui_DlgFilletEdges()), d(new DlgFilletEdgesP())
{
    ui->setupUi(this);

    d->object = 0;
    d->selection = new EdgeSelection(d->object);
    Gui::Selection().addSelectionGate(d->selection);

    d->fillet = fillet;
    d->connectApplicationDeletedObject = App::GetApplication().signalDeletedObject
        .connect(boost::bind(&DlgFilletEdges::onDeleteObject, this, _1));
    d->connectApplicationDeletedDocument = App::GetApplication().signalDeleteDocument
        .connect(boost::bind(&DlgFilletEdges::onDeleteDocument, this, _1));
    // set tree view with three columns
    QStandardItemModel* model = new FilletRadiusModel(this);
    connect(model, SIGNAL(toggleCheckState(const QModelIndex&)),
            this, SLOT(toggleCheckState(const QModelIndex&)));
    model->insertColumns(0,3);
    model->setHeaderData(0, Qt::Horizontal, tr("Edges to fillet"), Qt::DisplayRole);
    model->setHeaderData(1, Qt::Horizontal, tr("Start radius"), Qt::DisplayRole);
    model->setHeaderData(2, Qt::Horizontal, tr("End radius"), Qt::DisplayRole);
    ui->treeView->setRootIsDecorated(false);
    ui->treeView->setItemDelegate(new FilletRadiusDelegate(this));
    ui->treeView->setModel(model);

    QHeaderView* header = ui->treeView->header();
    header->setResizeMode(0, QHeaderView::Stretch);
    header->setDefaultAlignment(Qt::AlignLeft);
    header->setMovable(false);
    on_filletType_activated(0);
    findShapes();
}
Пример #4
0
FusionLayersSelectPage::FusionLayersSelectPage(QWidget* pParent) :
   FusionPage(pParent)
{
   QLabel* pLayerLabel = new QLabel("Available Layers for Fusion", this);

   QStringList columnNames;
   columnNames.append(LAYER_NAME_COLUMN);
   columnNames.append(LAYER_TYPE_COLUMN);

   mpLayerView = new QTreeWidget(this);
   mpLayerView->setColumnCount(columnNames.count());
   mpLayerView->setHeaderLabels(columnNames);
   mpLayerView->setSortingEnabled(true);
   mpLayerView->setSelectionMode(QAbstractItemView::ExtendedSelection);
   mpLayerView->setRootIsDecorated(false);

   QHeaderView* pHeader = mpLayerView->header();
   if (pHeader != NULL)
   {
      pHeader->setSortIndicatorShown(true);
      pHeader->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
      pHeader->setStretchLastSection(false);
      pHeader->resizeSection(0, 250);
   }

   // Layout
   QVBoxLayout* pLayout = new QVBoxLayout(this);
   pLayout->setMargin(0);
   pLayout->setSpacing(5);
   pLayout->addWidget(pLayerLabel, 0, Qt::AlignLeft);
   pLayout->addWidget(mpLayerView, 10);

   // Connections
   connect(mpLayerView, SIGNAL(itemSelectionChanged()), this, SIGNAL(modified()));
}
Пример #5
0
XMLInfoDialog::XMLInfoDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::XMLInfoDialog)
{
    ui->setupUi(this);

    setWindowTitle(tr("选择订阅"));
    setMinimumWidth(400);
    setMinimumHeight(450);
    setMaximumWidth(400);
    setMaximumHeight(450);

    QAbstractButton *okBtn = ui->buttonBox->button(QDialogButtonBox::Ok);
    QAbstractButton *cancelBtn = ui->buttonBox->button(QDialogButtonBox::Cancel);
    okBtn->setText(tr("确定"));
    cancelBtn->setText(tr("取消"));
    connect(cancelBtn, SIGNAL(clicked(bool)), this, SLOT(close()));
    connect(okBtn, SIGNAL(clicked(bool)), this, SLOT(subscriptionSelectedFinished()));

    QHeaderView *header = new QHeaderView(Qt::Horizontal, ui->treeWidget);
    header->setSectionResizeMode(QHeaderView::Stretch);
    header->setDefaultAlignment(Qt::AlignCenter);
    ui->treeWidget->setHeader(header);

    connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(treeItemChanged(QTreeWidgetItem*,int)));

}
Пример #6
0
// Constructor.
qtractorFileListView::qtractorFileListView (
	qtractorFileList::Type iFileType, QWidget *pParent )
	: QTreeWidget(pParent), m_iFileType(iFileType)
{
	m_pAutoOpenTimer   = NULL;
	m_iAutoOpenTimeout = 0;

	m_pDragItem = NULL;
	m_pDropItem = NULL;

	m_pRubberBand = NULL;

	QTreeWidget::setRootIsDecorated(false);
	QTreeWidget::setUniformRowHeights(true);
	QTreeWidget::setAlternatingRowColors(true);
//	QTreeWidget::setDragEnabled(true);
	QTreeWidget::setAcceptDrops(true);
	QTreeWidget::setDropIndicatorShown(true);
	QTreeWidget::setAutoScroll(true);
	QTreeWidget::setSelectionMode(QAbstractItemView::ExtendedSelection);
	QTreeWidget::setSizePolicy(
		QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
	QTreeWidget::setSortingEnabled(false);

	QHeaderView *pHeader = QTreeWidget::header();
	pHeader->setDefaultAlignment(Qt::AlignLeft);
//	pHeader->setDefaultSectionSize(160);
#if QT_VERSION >= 0x050000
//	pHeader->setSectionResizeMode(QHeaderView::Custom);
	pHeader->setSectionsMovable(false);
#else
//	pHeader->setResizeMode(QHeaderView::Custom);
	pHeader->setMovable(false);
#endif
	pHeader->setStretchLastSection(true);

	// Trap for help/tool-tips events.
	QTreeWidget::viewport()->installEventFilter(this);

	setAutoOpenTimeout(800);

	QObject::connect(this,
		SIGNAL(itemClicked(QTreeWidgetItem*,int)),
		SLOT(itemClickedSlot(QTreeWidgetItem*)));
	QObject::connect(this,
		SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
		SLOT(itemActivatedSlot(QTreeWidgetItem*)));
//	QObject::connect(this,
//		SIGNAL(itemActivated(QTreeWidgetItem*,int)),
//		SLOT(itemActivatedSlot(QTreeWidgetItem*)));
	QObject::connect(this,
		SIGNAL(itemExpanded(QTreeWidgetItem*)),
		SLOT(itemExpandedSlot(QTreeWidgetItem*)));
	QObject::connect(this,
		SIGNAL(itemCollapsed(QTreeWidgetItem*)),
		SLOT(itemCollapsedSlot(QTreeWidgetItem*)));
	QObject::connect(QTreeWidget::itemDelegate(),
		SIGNAL(commitData(QWidget*)),
		SLOT(itemRenamedSlot()));
}
Пример #7
0
MessageLogWindow::MessageLogWindow(const string& id, QWidget* pParent) :
   DockWindowAdapter(id, "Message Log Window", pParent),
   mpLogCombo(NULL),
   mpModel(NULL),
   mpMsgLogMgr(Service<MessageLogMgr>().get())
{
   QWidget* pWidget = new QWidget(this);

   // Message log item model
   mpModel = new MessageLogWindowModel;

   // Message tree
   QTreeView* pMessageTree = new QTreeView(pWidget);
   pMessageTree->setModel(mpModel);
   pMessageTree->setSelectionMode(QAbstractItemView::NoSelection);
   pMessageTree->setRootIsDecorated(true);

   QHeaderView* pHeader = pMessageTree->header();
   if (pHeader != NULL)
   {
      pHeader->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
      pHeader->setSortIndicatorShown(false);
   }

   // Message log combo
   mpLogCombo = new QComboBox(pWidget);

   // Layout
   QVBoxLayout* pLayout = new QVBoxLayout(pWidget);
   pLayout->setMargin(10);
   pLayout->setSpacing(5);
   pLayout->addWidget(pMessageTree, 10);
   pLayout->addWidget(mpLogCombo);

   // Initialization
   setIcon(QIcon(":/icons/MessageLogWindow"));
   setWidget(pWidget);

   vector<MessageLog*> logs = mpMsgLogMgr->getLogs();
   for (vector<MessageLog*>::const_iterator iter = logs.begin(); iter != logs.end(); ++iter)
   {
      MessageLog* pLog = *iter;
      if (pLog != NULL)
      {
         QString logName = getLogDisplayName(pLog);
         if (logName.isEmpty() == false)
         {
            mpLogCombo->addItem(logName);
         }
      }
   }

   setLog(mpLogCombo->currentText());

   // Connections
   VERIFYNR(connect(mpLogCombo, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(setLog(const QString&))));
   mpMsgLogMgr.addSignal(SIGNAL_NAME(MessageLogMgr, LogAdded), Slot(this, &MessageLogWindow::messageLogAdded));
   mpMsgLogMgr.addSignal(SIGNAL_NAME(MessageLogMgr, LogRemoved), Slot(this, &MessageLogWindow::messageLogRemoved));
}
Пример #8
0
/*! Sets up the size of the headers. Does not work in the constructor because there
    is not any data or model */
void AnalysesTableView::resizeHeaders(){
    QHeaderView* hHeader = horizontalHeader();
    hHeader->setMinimumSectionSize(10);
    hHeader->resizeSection(hHeader->logicalIndex(0), 30);//Check box
    hHeader->resizeSection(hHeader->logicalIndex(1), 50);//ID
    hHeader->resizeSection(hHeader->logicalIndex(2), 50);//Network id
    hHeader->resizeSection(hHeader->logicalIndex(3), 50);//Archive ID
    hHeader->resizeSection(hHeader->logicalIndex(4), 80);//Time
    hHeader->resizeSection(hHeader->logicalIndex(5), 200);//Description
    hHeader->resizeSection(hHeader->logicalIndex(6), 50);//Parameters
    hHeader->resizeSection(hHeader->logicalIndex(7), 50);//type
    hHeader->setDefaultAlignment(Qt::AlignLeft);
}
Пример #9
0
/*! Sets up the size of the headers. Does not work in the constructor because there
	is not any data or model */
void NeuronParametersView::resizeHeaders(){
	QHeaderView* hHeader = horizontalHeader();
	hHeader->setMinimumSectionSize(10);
	hHeader->resizeSection(hHeader->logicalIndex(0), 100);//Description
	QList<ParameterInfo> neuronParams = model->getParameterInfoList();
	for(int i=0; i<neuronParams.size(); ++i){
		int tmpParamLength = 10+neuronParams.at(i).getName().length() * 10;
		if(tmpParamLength < 40)
			tmpParamLength = 40;
		hHeader->resizeSection(hHeader->logicalIndex(i+1), tmpParamLength);//Parameter name
	}

	//Icon
	hHeader->resizeSection(hHeader->logicalIndex(neuronParams.size() + 1), 50);//Edit button
	hHeader->setDefaultAlignment(Qt::AlignLeft);
}
Пример #10
0
  PropertiesView::PropertiesView(Type type, QWidget *parent) : QTableView(parent),
      m_molecule(NULL), m_widget(NULL)
  {
    m_type = type;

    QString title;
    switch(type){
    case AtomType:
      title = tr("Atom Properties");
      break;
    case BondType:
      title = tr("Bond Properties");
      break;
    case AngleType:
      title = tr("Angle Properties");
      break;
    case TorsionType:
      title = tr("Torsion Properties");
      break;
    /*case CartesianType:
      title = tr("Cartesian Properties");
      break;*/
    case ConformerType:
      title = tr("Conformer Properties");
      break;
    default:
      break;
    }
    this->setWindowTitle(title);

    QHeaderView *horizontal = this->horizontalHeader();
    horizontal->setResizeMode(QHeaderView::Interactive);
    horizontal->setMinimumSectionSize(75);
    QHeaderView *vertical = this->verticalHeader();
    vertical->setResizeMode(QHeaderView::Interactive);
    vertical->setMinimumSectionSize(30);
    vertical->setDefaultAlignment(Qt::AlignCenter);

    // Don't allow selecting everything
    setCornerButtonEnabled(false);
    // Alternating row colors
    setAlternatingRowColors(true);
    // Allow sorting the table
    setSortingEnabled(true);
  }
Пример #11
0
Legend::Legend(QWidget* parent) :
   QTreeWidget(parent),
   mSecondaryObjects(false)
{
   setColumnCount(1);
   setRootIsDecorated(false);
   setSelectionMode(QAbstractItemView::NoSelection);
   setSortingEnabled(false);
   setFocusPolicy(Qt::NoFocus);

   QHeaderView* pHeader = header();
   if (pHeader != NULL)
   {
      pHeader->setMovable(false);
      pHeader->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
      pHeader->hide();
   }
}
Пример #12
0
//-----------------------------------------------------------------------------
//!
//-----------------------------------------------------------------------------
void tWorkProfilesDialog::Init()
{
    QSize iconSize( 68, 68 );

    m_pProfilesTable = new tTableWidget( 0, eColumnCount, this );
    m_pProfilesTable->setFrameShape( QFrame::NoFrame );
    m_pProfilesTable->SetSoleFocus( true );
    m_pProfilesTable->SetWrapping( false );

    QHeaderView* pHorizontalHeaderView = m_pProfilesTable->horizontalHeader();
    pHorizontalHeaderView->setClickable( false );
    pHorizontalHeaderView->resizeSection( eIconColumn, iconSize.width() );

    pHorizontalHeaderView->setResizeMode( eNameColumn, QHeaderView::Stretch );

    QString nameString = QString( tr( "Name" ) );
    QSize headerTextSize = pHorizontalHeaderView->fontMetrics().size( 0, nameString ); 
    int w = headerTextSize.width() + 10;
    pHorizontalHeaderView->resizeSection( eNameColumn, w );

    QStringList headings;
    headings << "" << nameString << tr( "Enabled" ) << tr( "Active" );
    m_pProfilesTable->setHorizontalHeaderLabels( headings );

    pHorizontalHeaderView->setDefaultAlignment( Qt::AlignLeft );

    QHeaderView* pVerticalHeaderView = m_pProfilesTable->verticalHeader();
    pVerticalHeaderView->hide();
    pVerticalHeaderView->setResizeMode( QHeaderView::Fixed );
    pVerticalHeaderView->setDefaultSectionSize( iconSize.height() );

    QVBoxLayout* pVLayout = new QVBoxLayout( this );
    pVLayout->setContentsMargins( 0, 0, 0, 0 );

    pVLayout->addWidget( m_pProfilesTable );

    setLayout( pVLayout );

    UpdateTable();

    m_pProfilesTable->selectRow( m_ProfileIndex );

}
LibraryEditDlg::LibraryEditDlg(const std::vector<Signature*>& signatures, QWidget* pParent) :
   mpTree(NULL),
   QDialog(pParent, Qt::WindowCloseButtonHint)
{
   setWindowTitle("Spectral Library Editor");
   mpTree = new QTreeWidget(this);
   QStringList columnNames;
   columnNames << "Signatures";
   mpTree->setColumnCount(columnNames.count());
   mpTree->setHeaderLabels(columnNames);
   mpTree->setSelectionMode(QAbstractItemView::ExtendedSelection);
   mpTree->setAllColumnsShowFocus(true);
   mpTree->setRootIsDecorated(true);
   mpTree->setSortingEnabled(false);
   mpTree->setToolTip("This list displays the spectral library matches for in-scene spectra.");

   QHeaderView* pHeader = mpTree->header();
   if (pHeader != NULL)
   {
      pHeader->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
      pHeader->resizeSection(0, 150);
   }

   QDialogButtonBox* pButtons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
      Qt::Vertical, this);
   QPushButton* pAdd = new QPushButton("Add...", this);
   QPushButton* pRemove = new QPushButton("Remove", this);
   pButtons->addButton(pAdd, QDialogButtonBox::ActionRole);
   pButtons->addButton(pRemove, QDialogButtonBox::ActionRole);

   QGridLayout* pGrid = new QGridLayout(this);
   pGrid->addWidget(mpTree, 0, 0, 6, 1);
   pGrid->addWidget(pButtons, 0, 1, 6, 1);

   VERIFYNR(connect(pButtons, SIGNAL(accepted()), this, SLOT(accept())));
   VERIFYNR(connect(pButtons, SIGNAL(rejected()), this, SLOT(reject())));
   VERIFYNR(connect(pAdd, SIGNAL(clicked()), this, SLOT(addSignatures())));
   VERIFYNR(connect(pRemove, SIGNAL(clicked()), this, SLOT(removeSignatures())));

   addSignatures(signatures);
}
Пример #14
0
TiePointEditor::TiePointEditor(QWidget* pParent) :
    QDialog(pParent),
    mpTableView(NULL),
    mpAddButton(NULL),
    mpDeleteButton(NULL),
    mpGoToButton(NULL),
    mpLayer(NULL),
    mpTableModel(new TiePointTableModel(this))
{
    // Table
    mpTableView = new QTableView(this);
    mpTableView->setSelectionMode(QAbstractItemView::SingleSelection);
    mpTableView->setEditTriggers(QAbstractItemView::DoubleClicked | QAbstractItemView::SelectedClicked |
                                 QAbstractItemView::EditKeyPressed);
    mpTableView->setSortingEnabled(false);
    mpTableView->setCornerButtonEnabled(false);
    mpTableView->setModel(mpTableModel);

    QHeaderView* pHorizHeader = mpTableView->horizontalHeader();
    if (pHorizHeader != NULL)
    {
        pHorizHeader->setDefaultSectionSize(75);
        pHorizHeader->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
    }

    QHeaderView* pVerticalHeader = mpTableView->verticalHeader();
    if (pVerticalHeader != NULL)
    {
        pVerticalHeader->setDefaultSectionSize(20);
    }

    // Buttons
    mpAddButton = new QPushButton("&Add", this);
    mpDeleteButton = new QPushButton("&Delete", this);
    mpGoToButton = new QPushButton("&Go To...", this);
    QPushButton* pCloseButton = new QPushButton("&Close", this);

    // Layout
    QGridLayout* pGrid = new QGridLayout(this);
    pGrid->setMargin(10);
    pGrid->setSpacing(5);
    pGrid->addWidget(mpTableView, 0, 0, 1, 4);
    pGrid->addWidget(mpAddButton, 1, 0, Qt::AlignRight);
    pGrid->addWidget(mpDeleteButton, 1, 1);
    pGrid->addWidget(mpGoToButton, 1, 2);
    pGrid->addWidget(pCloseButton, 1, 3);
    pGrid->setRowStretch(0, 10);
    pGrid->setColumnStretch(0, 10);

    // Initialization
    setWindowTitle("Tie Point Editor");
    setModal(false);
    resize(700, 400);
    enableButtons(false);

    // Connections
    VERIFYNR(connect(mpTableModel, SIGNAL(pointsModified(const std::vector<TiePoint>&, const std::vector<TiePoint>&)),
                     this, SLOT(pointsEdited(const std::vector<TiePoint>&, const std::vector<TiePoint>&))));
    VERIFYNR(connect(mpAddButton, SIGNAL(clicked()), this, SLOT(addPoint())));
    VERIFYNR(connect(mpDeleteButton, SIGNAL(clicked()), this, SLOT(deletePoint())));
    VERIFYNR(connect(mpGoToButton, SIGNAL(clicked()), this, SLOT(goToRow())));
    VERIFYNR(connect(pCloseButton, SIGNAL(clicked()), this, SLOT(close())));
}
Пример #15
0
ShapeFileOptionsWidget::ShapeFileOptionsWidget(ShapeFile* pShapefile, const vector<AoiElement*>& aois, 
                                               RasterElement* pRaster) :
   QWidget(NULL), mpShapeFile(pShapefile), mAois(aois), mpGeoref(pRaster)
{
   // Filenames
   QLabel* pFilePathLabel = new QLabel("File Path:", this);
   QLabel* pBaseNameLabel = new QLabel("Base Name:", this);
   QLabel* pShpLabel = new QLabel("SHP:", this);
   QLabel* pShxLabel = new QLabel("SHX:", this);
   QLabel* pDbfLabel = new QLabel("DBF:", this);

   QFont ftBold = QApplication::font();
   ftBold.setBold(true);

   pFilePathLabel->setFont(ftBold);
   pBaseNameLabel->setFont(ftBold);
   pShpLabel->setFont(ftBold);
   pShxLabel->setFont(ftBold);
   pDbfLabel->setFont(ftBold);

   mpFilePathEdit = new QLineEdit(this);
   mpFilePathEdit->setReadOnly(true);

   mpBaseNameEdit = new QLineEdit(this);
   mpBaseNameEdit->setFixedWidth(150);

   mpShpFileLabel = new QLabel(this);
   mpShxFileLabel = new QLabel(this);
   mpDbfFileLabel = new QLabel(this);

   // Browse button
   QIcon icnBrowse(":/icons/Open");
   QPushButton* pBrowseButton = new QPushButton(icnBrowse, QString(), this);
   pBrowseButton->setFixedWidth(27);

   // Shape type
   QLabel* pShapeLabel = new QLabel("Shape:", this);
   pShapeLabel->setFont(ftBold);

   mpShapeCombo = new QComboBox(this);
   mpShapeCombo->setEditable(false);
   mpShapeCombo->setFixedWidth(150);
   vector<string> comboText = StringUtilities::getAllEnumValuesAsDisplayString<ShapefileTypes::ShapeType>();
   for (vector<string>::iterator it = comboText.begin(); it != comboText.end(); ++it)
   {
      mpShapeCombo->addItem(QString::fromStdString(*it));
   }

   // Feature list
   QLabel* pFeatureLabel = new QLabel("Features:", this);

   QStringList columnNames;
   columnNames.append("Feature");

   mpFeatureTree = new CustomTreeWidget(this);
   mpFeatureTree->setColumnCount(columnNames.count());
   mpFeatureTree->setHeaderLabels(columnNames);
   mpFeatureTree->setSelectionMode(QAbstractItemView::SingleSelection);
   mpFeatureTree->setRootIsDecorated(false);
   mpFeatureTree->setSortingEnabled(true);

   QHeaderView* pHeader = mpFeatureTree->header();
   if (pHeader != NULL)
   {
      pHeader->setSortIndicatorShown(true);
      pHeader->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
      pHeader->setStretchLastSection(false);
   }

   // Feature buttons
   QPushButton* pAddFeatureButton = new QPushButton("Add Feature", this);
   QPushButton* pRemoveFeatureButton = new QPushButton("Remove Feature", this);
   QPushButton* pClearFeatureButton = new QPushButton("Clear Features", this);

   // Field buttons
   QPushButton* pAddFieldButton = new QPushButton("Add Field", this);
   QPushButton* pRemoveFieldButton = new QPushButton("Remove Field", this);

   // Layout
   QHBoxLayout* pFilePathLayout = new QHBoxLayout();
   pFilePathLayout->setMargin(0);
   pFilePathLayout->setSpacing(5);
   pFilePathLayout->addWidget(mpFilePathEdit, 10);
   pFilePathLayout->addWidget(pBrowseButton);

   QHBoxLayout* pNameShapeLayout = new QHBoxLayout();
   pNameShapeLayout->setMargin(0);
   pNameShapeLayout->setSpacing(5);
   pNameShapeLayout->addWidget(mpBaseNameEdit);
   pNameShapeLayout->addSpacing(20);
   pNameShapeLayout->addWidget(pShapeLabel);
   pNameShapeLayout->addWidget(mpShapeCombo);
   pNameShapeLayout->addStretch();

   QVBoxLayout* pButtonLayout = new QVBoxLayout();
   pButtonLayout->setMargin(0);
   pButtonLayout->setSpacing(5);
   pButtonLayout->addWidget(pAddFeatureButton);
   pButtonLayout->addWidget(pRemoveFeatureButton);
   pButtonLayout->addWidget(pClearFeatureButton);
   pButtonLayout->addStretch(10);
   pButtonLayout->addWidget(pAddFieldButton);
   pButtonLayout->addWidget(pRemoveFieldButton);

   QGridLayout* pGrid = new QGridLayout(this);
   pGrid->setMargin(10);
   pGrid->setSpacing(5);
   pGrid->addWidget(pFilePathLabel, 0, 0);
   pGrid->addLayout(pFilePathLayout, 0, 1, 1, 3);
   pGrid->addWidget(pBaseNameLabel, 1, 0);
   pGrid->addLayout(pNameShapeLayout, 1, 1, 1, 3);
   pGrid->addWidget(pShpLabel, 2, 0);
   pGrid->addWidget(mpShpFileLabel, 2, 1, 1, 3);
   pGrid->addWidget(pShxLabel, 3, 0);
   pGrid->addWidget(mpShxFileLabel, 3, 1, 1, 3);
   pGrid->addWidget(pDbfLabel, 4, 0);
   pGrid->addWidget(mpDbfFileLabel, 4, 1, 1, 3);
   pGrid->setRowMinimumHeight(5, 12);
   pGrid->addWidget(pFeatureLabel, 6, 0, 1, 4);
   pGrid->addWidget(mpFeatureTree, 7, 0, 1, 2);
   pGrid->setColumnMinimumWidth(2, 2);
   pGrid->addLayout(pButtonLayout, 7, 3);
   pGrid->setRowStretch(7, 10);
   pGrid->setColumnStretch(1, 10);

   // Initialization
   setWindowTitle("Shape File");

   if (mpShapeFile != NULL)
   {
      // Filename
      const string& filename = mpShapeFile->getFilename();
      if (!filename.empty())
      {
         QFileInfo fileInfo(QString::fromStdString(filename));
         mpFilePathEdit->setText(fileInfo.absolutePath());
         mpBaseNameEdit->setText(fileInfo.completeBaseName());
      }

      updateFilenames();

      // Shape
      int index = ShapefileTypes::getIndex(mpShapeFile->getShape());
      if (index < 0)
      {
         index = 0;
      }
      mpShapeCombo->setCurrentIndex(index);

      // Features
      const vector<Feature*>& features = mpShapeFile->getFeatures();
      for (unsigned int i = 0; i < features.size(); i++)
      {
         Feature* pFeature = features[i];
         if (pFeature != NULL)
         {
            QTreeWidgetItem* pItem = new QTreeWidgetItem(mpFeatureTree);
            if (pItem != NULL)
            {
               pItem->setText(0, QString::number(i + 1));
               mFeatures.insert(pItem, pFeature);
            }
         }
      }

      // Fields
      updateFieldValues();
   }

   // Connections
   connect(mpFilePathEdit, SIGNAL(textChanged(const QString&)), this, SLOT(updateFilenames()));
   connect(pBrowseButton, SIGNAL(clicked()), this, SLOT(browse()));
   connect(mpBaseNameEdit, SIGNAL(textChanged(const QString&)), this, SLOT(updateFilenames()));
   connect(mpShapeCombo, SIGNAL(activated(const QString&)), this, SLOT(setShape(const QString&)));
   connect(pAddFeatureButton, SIGNAL(clicked()), this, SLOT(addFeature()));
   connect(pRemoveFeatureButton, SIGNAL(clicked()), this, SLOT(removeFeature()));
   connect(pClearFeatureButton, SIGNAL(clicked()), this, SLOT(clearFeatures()));
   connect(pAddFieldButton, SIGNAL(clicked()), this, SLOT(addField()));
   connect(pRemoveFieldButton, SIGNAL(clicked()), this, SLOT(removeField()));
   connect(mpFeatureTree, SIGNAL(cellTextChanged(QTreeWidgetItem*, int)), this, SLOT(setFieldValue(QTreeWidgetItem*, int)));
}
Пример #16
0
void PlotSettingsDialog::setupSourceTable(const QStringList &dataSeriesNames, const PlotSettings &preset, bool offsetsEditable)
{
    ui->sourceTable->setColumnCount(COLCOUNT);

    QTableWidgetItem *sourceNameColHeader = new QTableWidgetItem(tr("Data Series Name"));
    sourceNameColHeader->setToolTip(tr("The name of the data series."));
    ui->sourceTable->setHorizontalHeaderItem(SOURCENAMECOL, sourceNameColHeader);

    QTableWidgetItem *offsetColHeader = new QTableWidgetItem(tr("Offset"));
    offsetColHeader->setToolTip(tr("The offset in milliseconds.\n\n"
                                   "This value is added to each timestamp\n"
                                   "of the respective data series.\n"
                                   "You can use this for example to adjust for\n"
                                   "time lags in the transmission of signals."));
    ui->sourceTable->setHorizontalHeaderItem(OFFSETCOL, offsetColHeader);

    QTableWidgetItem *scaleColHeader = new QTableWidgetItem(tr("Scale Type"));
    if (offsetsEditable) {
        scaleColHeader->setToolTip(tr("The <i>default</i> type of scale to be used for the data series."));
    } else {
        scaleColHeader->setToolTip(tr("The type of scale to be used for the data series."));
    }
    ui->sourceTable->setHorizontalHeaderItem(SCALECOL, scaleColHeader);

    QHeaderView *hHeader = ui->sourceTable->horizontalHeader();
    hHeader->setDefaultAlignment(Qt::AlignLeft);
    hHeader->setResizeMode(SOURCENAMECOL, QHeaderView::Stretch);
    hHeader->setResizeMode(OFFSETCOL, QHeaderView::ResizeToContents);
    hHeader->setResizeMode(SCALECOL, QHeaderView::ResizeToContents);
    hHeader->setMinimumSectionSize(120);

    QHeaderView *vHeader = ui->sourceTable->verticalHeader();
    vHeader->setVisible(false);

    foreach (QString sourceName, dataSeriesNames) {
        int row = ui->sourceTable->rowCount();
        ui->sourceTable->setRowCount(row + 1);

        QTableWidgetItem *sourceItem = new QTableWidgetItem(sourceName);
        // the item showing the data series name should not be editable
        sourceItem->setFlags(sourceItem->flags() & ~Qt::ItemIsEditable);
        ui->sourceTable->setItem(row, SOURCENAMECOL, sourceItem);

        QDoubleSpinBox *offsetSpinner = new QDoubleSpinBox(ui->sourceTable);
        offsetSpinner->setAlignment(Qt::AlignRight);
        // helps to set the min/max before you set the value ;)
        offsetSpinner->setMinimum(0.0);
        offsetSpinner->setMaximum(std::numeric_limits<double>::max());
        offsetSpinner->setDecimals(qRound(qLn(OFFSETDIVISOR)/qLn(10)));
        offsetSpinner->setValue(preset.offset(sourceName)/OFFSETDIVISOR);
        offsetSpinner->setEnabled(offsetsEditable);
        ui->sourceTable->setCellWidget(row, OFFSETCOL, offsetSpinner);

        if (preset.scaleType(sourceName) == PlotSettings::NOT_SCALABLE) {
            QTableWidgetItem *scaleItem = new QTableWidgetItem(tr("n/a"));
            scaleItem->setFlags(scaleItem->flags() & ~Qt::ItemIsEditable);
            ui->sourceTable->setItem(row, SCALECOL, scaleItem);
        } else {
            QComboBox *scaleCombo = new QComboBox();
            scaleCombo->addItems(PlotSettings::scaleTypeNames);
            scaleCombo->setCurrentIndex(preset.scaleType(sourceName));
            ui->sourceTable->setCellWidget(row, SCALECOL, scaleCombo);
        }
    }
Пример #17
0
//--------------------------------------------------------------------------------------
//! Defines the NDP2k network device page (shows the devices)
//--------------------------------------------------------------------------------------
tNDP2kDevicePage::tNDP2kDevicePage(tNDP2k& ndp2k, QWidget* pParent, bool showButtons, const QList<eColumns> customColumnList )
    : tDialog(tDialog::Full, pParent)
    , m_pNDP2k( &ndp2k )
    , m_FirstRefresh ( true )
    , m_FirstRun( true )
    , m_tableRefreshMode( false )
    , m_ShowNameColumn( false ) // For debugging purposes 
    , m_ShowButtons( showButtons )
{
    setWindowTitle( tr( "Device List", "NDP2k device list dialog title" ) );

    m_ColumnName[addressColumn] = tr("Address");
    m_ColumnName[modelIdColumn] = tr("Model ID");
    m_ColumnName[manufacturerColumn] = tr("Manufacturer");
    m_ColumnName[productCodeColumn] = tr("Product Code");
    m_ColumnName[classFunctionColumn] = tr("Class/Function");
    m_ColumnName[nameColumn] = tr("ISO Name");
    m_ColumnName[busUsageColumn] = tr("Bus %");
    m_ColumnName[deviceInstanceColumn] = tr("Instance");
    m_ColumnName[serialNumberColumn] = tr("Serial No.");

    // keep name last - it is hidden & not in sort list.
    if( false == customColumnList.isEmpty() )
    {
        m_DisplayColumns = customColumnList;
    }
    else
    {
        m_DisplayColumns = (QList<eColumns>() << modelIdColumn << serialNumberColumn);
    }

    if( tNdp2kSettings::Instance()->GetDebugEnabled() )
    {
        m_DisplayColumns << addressColumn;
        m_ShowNameColumn = true;
    }
    m_DisplayColumns << nameColumn;

    assert(m_DisplayColumns.contains(nameColumn));
    m_NameColumn = m_DisplayColumns.indexOf(nameColumn);

    m_SortOptionList = QStringList();
    m_SortOption = 0;
    for(int i = 0; i < m_DisplayColumns.count(); i++)
    {
        if( m_DisplayColumns[i] != nameColumn || m_ShowNameColumn )
        {
            m_SortOptionList << m_ColumnName[m_DisplayColumns[i]];
        }
    }

    // if we have a SKB keys don't have focus, else hide keys 
    m_NumKeys = 0;
    if ( HasSoftKeyBar() )
    {
        m_NumKeys = SoftKeyBar()->numSoftKeys(); 
        SoftKeyBar()->SetSoftKeyFocusPolicy(Qt::NoFocus);
    }
    else
    {
        SoftKeyBar()->ExplicitHide();
    }
    CreateActions();
    Connect( this, SIGNAL( CloseRequested() ), this, SLOT( accept() ) );

    m_pTableWidget = new tTableWidget(0, m_DisplayColumns.count(), this);
    m_pTableWidget->setFocusPolicy(Qt::StrongFocus);
    m_pTableWidget->setEditTriggers( QAbstractItemView::NoEditTriggers );
    m_pTableWidget->verticalHeader()->hide();
    m_pTableWidget->setSelectionMode(QAbstractItemView::SingleSelection);
    m_pTableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
    m_pTableWidget->SetSoleFocus( true );
    m_pTableWidget->SetWrapping( true );

    if( tUiSettings::Instance()->ShowTouchToolTips() == true )
    {
        m_pTableWidget->setToolTip( tr("Tap-and-hold for more options.") );
    }
    else
    {
        m_pTableWidget->setToolTip( tr("Press %1 for more options.").arg(BUTTON_HTML(tNOSStyle::FP_ButtonImageMENU, "MENU")) ); 
    }

    Connect( m_pTableWidget, SIGNAL( itemSelectionChanged() ), this, SLOT( SelectionChanged() ) );
    Connect( m_pTableWidget, SIGNAL( itemClicked( QTableWidgetItem* ) ), m_pDetailsAct, SLOT( trigger() ) );

    QHeaderView* pHeaderView = m_pTableWidget->horizontalHeader();
    // Prevents header bold font
    pHeaderView->setHighlightSections(false);
    pHeaderView->setDefaultAlignment(Qt::AlignLeft);
    Connect( pHeaderView, SIGNAL( sectionClicked( int ) ), this, SLOT( SetSortOption( int ) ) );
    SetHeaderFont();

    for(int i = 0; i < m_DisplayColumns.count(); i++)
    {
        switch(m_DisplayColumns[i])
        {
        case addressColumn:
        case manufacturerColumn:
        case productCodeColumn:
        case busUsageColumn:
        case deviceInstanceColumn:
        case serialNumberColumn:
        default:
            {
                pHeaderView->setResizeMode(i, QHeaderView::ResizeToContents);
            }
            break;

        case modelIdColumn:
        case SwVersionColumn:
        case classFunctionColumn:
            {
                pHeaderView->setResizeMode(i, QHeaderView::Stretch);
            }
            break;

        case nameColumn:
            {
                if( m_ShowNameColumn )
                {
                    pHeaderView->setResizeMode(i, QHeaderView::Stretch);
                }
                else
                {
                    pHeaderView->setResizeMode(i, QHeaderView::Fixed);
                    pHeaderView->resizeSection(i, 0); // hide it this way. (actual hide breaks sorting.)
                }
            }
            break;
        }
    }

    QStringList headings;
    for(int i = 0; i < m_DisplayColumns.count(); i++)
    {
        headings << m_ColumnName[m_DisplayColumns[i]];
    }
    m_pTableWidget->setHorizontalHeaderLabels(headings);

    QVBoxLayout* pVLayout = new QVBoxLayout;
    pVLayout->addWidget(m_pTableWidget);
    setLayout(pVLayout);

    tNDP2k* pNDP2k = tGlobal<tNDP2k>::Instance();
    Connect(&pNDP2k->DeviceManager(), SIGNAL(DeviceListChanged(const tN2kName&)), this, SLOT(OnDeviceChanged(const tN2kName&)));

    /* Set the bus status on startup... */
    if(pNDP2k->IsBusOff())
    {
        m_IsBusOff = true;
    }
    else
    {
        m_IsBusOff = false;
    }

    m_SelectedName = "";
    
    //NSW-7687 (Work around LGC-4k unreliable response to global request for address claim...)
    // - No longer required - since we no longer do a global request for address claim.
    RefreshDeviceList();
    // initial row selected in UpdateDeviceList, when we have some content

    startTimer(1000);
    //TODO: tNotificationAndStatusMonitor::Instance()->SetVesselShow(false);

    if ( tProductSettings::Instance().GetProductFamily() == tProductSettings::MedusaFamily )
    {
        Connect( tApOperation::Instance(), SIGNAL( ApModeChanged(tPilotCommandInterface::tPilotMode) ), this, SLOT( OnApModeChanged(tPilotCommandInterface::tPilotMode) ) );
        OnApModeChanged( tApOperation::Instance()->GetApMode() ); // Init text
    }

    if( tProductSettings::Instance().ScreenPixelWidth() < 480 )
    {
        pVLayout->setMargin(0);
    }
}
Пример #18
0
// Constructor.
qtractorTimeScaleForm::qtractorTimeScaleForm (
	QWidget *pParent, Qt::WindowFlags wflags )
	: QDialog(pParent, wflags)
{
	// Setup UI struct...
	m_ui.setupUi(this);

	// Window modality (let plugin/tool windows rave around).
	QDialog::setWindowModality(Qt::WindowModal);

	// Initialize locals.
	m_pTimeScale  = NULL;

	m_pTempoTap   = new QTime();
	m_iTempoTap   = 0;
	m_fTempoTap   = 0.0f;

	m_iDirtySetup = 0;
	m_iDirtyCount = 0;
	m_iDirtyTotal = 0;

	QHeaderView *pHeader = m_ui.TimeScaleListView->header();
	pHeader->setDefaultAlignment(Qt::AlignLeft);
#if QT_VERSION >= 0x050000
//	pHeader->setSectionResizeMode(QHeaderView::Custom);
	pHeader->setSectionResizeMode(QHeaderView::ResizeToContents);
	pHeader->setSectionsMovable(false);
#else
//	pHeader->setResizeMode(QHeaderView::Custom);
	pHeader->setResizeMode(QHeaderView::ResizeToContents);
	pHeader->setMovable(false);
#endif

	m_ui.TimeScaleListView->setItemDelegate(
		new qtractorTimeScaleItemDelegate(m_ui.TimeScaleListView));
	m_ui.TimeScaleListView->setContextMenuPolicy(Qt::CustomContextMenu);

	// (Re)initial contents.
	// Default is main session time-scale of course...
	qtractorSession *pSession = qtractorSession::getInstance();
	if (pSession)
		setTimeScale(pSession->timeScale());

	// Try to restore normal window positioning.
	adjustSize();

	// UI signal/slot connections...
	QObject::connect(m_ui.TimeScaleListView,
		SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
		SLOT(selectItem()));
	QObject::connect(m_ui.TimeScaleListView,
		SIGNAL(customContextMenuRequested(const QPoint&)),
		SLOT(contextMenu(const QPoint&)));

	QObject::connect(m_ui.BarSpinBox,
		SIGNAL(valueChanged(int)),
		SLOT(barChanged(int)));
	QObject::connect(m_ui.TimeSpinBox,
		SIGNAL(valueChanged(unsigned long)),
		SLOT(timeChanged(unsigned long)));
	QObject::connect(m_ui.TimeSpinBox,
		SIGNAL(displayFormatChanged(int)),
		SLOT(refreshItems()));

	QObject::connect(m_ui.TempoSpinBox,
		SIGNAL(valueChanged(float, unsigned short, unsigned short)),
		SLOT(tempoChanged()));
	QObject::connect(m_ui.TempoSpinBox,
		SIGNAL(valueChanged(const QString&)),
		SLOT(tempoChanged()));
	QObject::connect(m_ui.TempoTapPushButton,
		SIGNAL(clicked()),
		SLOT(tempoTap()));
	QObject::connect(m_ui.TempoFactorPushButton,
		SIGNAL(clicked()),
		SLOT(tempoFactor()));

	QObject::connect(m_ui.MarkerTextLineEdit,
		SIGNAL(textChanged(const QString&)),
		SLOT(changed()));
	QObject::connect(m_ui.MarkerColorToolButton,
		SIGNAL(clicked()),
		SLOT(markerColor()));

	QObject::connect(m_ui.RefreshPushButton,
		SIGNAL(clicked()),
		SLOT(refresh()));
	QObject::connect(m_ui.AddPushButton,
		SIGNAL(clicked()),
		SLOT(addItem()));
	QObject::connect(m_ui.UpdatePushButton,
		SIGNAL(clicked()),
		SLOT(updateItem()));
	QObject::connect(m_ui.RemovePushButton,
		SIGNAL(clicked()),
		SLOT(removeItem()));
	QObject::connect(m_ui.ClosePushButton,
		SIGNAL(clicked()),
		SLOT(reject()));

	stabilizeForm();
}
Пример #19
0
MetadataWidget::MetadataWidget(QWidget* parent) :
   QWidget(parent),
   mpMetadata(NULL)
{
   // Metadata
   QLabel* pMetadataLabel = new QLabel("Metadata:", this);

   mpMetadataModel = new DynamicObjectItemModel(this, NULL);
   mpMetadataSortingModel = new QSortFilterProxyModel(this);
   mpMetadataSortingModel->setSortCaseSensitivity(Qt::CaseInsensitive);
   mpMetadataSortingModel->setSourceModel(mpMetadataModel);

   mpMetadataTree = new QTreeView(this);
   mpMetadataTree->setSelectionMode(QAbstractItemView::SingleSelection);
   mpMetadataTree->setRootIsDecorated(true);
   mpMetadataTree->setSortingEnabled(true);
   mpMetadataTree->sortByColumn(0, Qt::AscendingOrder);
   mpMetadataTree->setUniformRowHeights(true);
   mpMetadataTree->setModel(mpMetadataSortingModel);
   mpMetadataTree->setSelectionBehavior(QAbstractItemView::SelectRows);
   mpMetadataTree->setAllColumnsShowFocus(true);
   mpMetadataTree->setContextMenuPolicy(Qt::ActionsContextMenu);
   QAction* pCopyIdAction = new QAction("Copy item ID to clipboard", mpMetadataTree);
   mpMetadataTree->addAction(pCopyIdAction);
   QAction* pCopyValueAction = new QAction("Copy item value to clipboard", mpMetadataTree);
   mpMetadataTree->addAction(pCopyValueAction);

   QHeaderView* pHeader = mpMetadataTree->header();
   if (pHeader != NULL)
   {
      pHeader->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
      pHeader->setSortIndicatorShown(true);
      pHeader->resizeSection(1, 200); // Set the default Value column width
   }

   // Filter
   mpFilterCheck = new QCheckBox("Filter:", this);
   mpFilterCombo = new QComboBox(this);
   mpFilterCombo->setEditable(false);

   // Buttons
   mpCreateFilterButton = new QToolButton(this);
   mpCreateFilterButton->setIcon(QIcon(":/icons/CreateFilter"));
   mpCreateFilterButton->setToolTip("Create Filter");
   mpCreateFilterButton->setAutoRaise(true);

   mpEditFilterButton = new QToolButton(this);
   mpEditFilterButton->setIcon(QIcon(":/icons/EditFilter"));
   mpEditFilterButton->setToolTip("Edit Filter");
   mpEditFilterButton->setAutoRaise(true);

   mpDeleteFilterButton = new QToolButton(this);
   mpDeleteFilterButton->setIcon(QIcon(":/icons/DeleteFilter"));
   mpDeleteFilterButton->setToolTip("Delete Filter");
   mpDeleteFilterButton->setAutoRaise(true);

   mpModifyButton = new QToolButton(this);
   mpModifyButton->setIcon(QIcon(":/icons/ModifyMetadata"));
   mpModifyButton->setToolTip("Modify Values");
   mpModifyButton->setAutoRaise(true);

   mpAddChildButton = new QToolButton(this);
   mpAddChildButton->setIcon(QIcon(":/icons/AddMetadataChild"));
   mpAddChildButton->setToolTip("Add Child");
   mpAddChildButton->setAutoRaise(true);

   mpAddSiblingButton = new QToolButton(this);
   mpAddSiblingButton->setIcon(QIcon(":/icons/AddMetadataSibling"));
   mpAddSiblingButton->setToolTip("Add Sibling");
   mpAddSiblingButton->setAutoRaise(true);

   mpEditButton = new QToolButton(this);
   mpEditButton->setIcon(QIcon(":/icons/EditMetadataValue"));
   mpEditButton->setToolTip("Edit");
   mpEditButton->setAutoRaise(true);

   mpDeleteButton = new QToolButton(this);
   mpDeleteButton->setIcon(QIcon(":/icons/DeleteMetadataValue"));
   mpDeleteButton->setToolTip("Delete");
   mpDeleteButton->setAutoRaise(true);

   mpClearButton = new QToolButton(this);
   mpClearButton->setIcon(QIcon(":/icons/ClearMetadata"));
   mpClearButton->setToolTip("Clear");
   mpClearButton->setAutoRaise(true);

   // Layout
   QHBoxLayout* pButtonLayout = new QHBoxLayout();
   pButtonLayout->setMargin(0);
   pButtonLayout->setSpacing(0);
   pButtonLayout->addWidget(mpCreateFilterButton);
   pButtonLayout->addWidget(mpEditFilterButton);
   pButtonLayout->addWidget(mpDeleteFilterButton);
   pButtonLayout->addSpacing(15);
   pButtonLayout->addStretch();
   pButtonLayout->addWidget(mpModifyButton);
   pButtonLayout->addSpacing(15);
   pButtonLayout->addWidget(mpAddChildButton);
   pButtonLayout->addWidget(mpAddSiblingButton);
   pButtonLayout->addWidget(mpEditButton);
   pButtonLayout->addWidget(mpDeleteButton);
   pButtonLayout->addWidget(mpClearButton);

   QGridLayout* pGrid = new QGridLayout(this);
   pGrid->setMargin(0);
   pGrid->setSpacing(5);
   pGrid->addWidget(pMetadataLabel, 0, 0, 1, 2);
   pGrid->addWidget(mpMetadataTree, 1, 0, 1, 2);
   pGrid->addWidget(mpFilterCheck, 2, 0);
   pGrid->addWidget(mpFilterCombo, 2, 1);
   pGrid->addLayout(pButtonLayout, 3, 0, 1, 2);
   pGrid->setRowStretch(1, 10);
   pGrid->setColumnStretch(1, 10);

   Service<DesktopServices> pDesktop;
   bool editWarning = pDesktop->getSuppressibleMsgDlgState(getEditWarningDialogId());

   // Initialization
   mpFilterCombo->setEnabled(false);
   mpCreateFilterButton->setEnabled(false);
   mpEditFilterButton->setEnabled(false);
   mpDeleteFilterButton->setEnabled(false);
   mpModifyButton->setEnabled(!editWarning);
   mpAddChildButton->setEnabled(editWarning);
   mpAddSiblingButton->setEnabled(false);
   mpEditButton->setEnabled(false);
   mpDeleteButton->setEnabled(false);
   mpClearButton->setEnabled(editWarning);

   // Connections
   if (editWarning == true)
   {
      VERIFYNR(connect(mpMetadataTree->selectionModel(), SIGNAL(currentChanged(const QModelIndex&, const QModelIndex&)),
         this, SLOT(currentChanged(const QModelIndex&, const QModelIndex&))));
      VERIFYNR(connect(mpMetadataTree, SIGNAL(doubleClicked(const QModelIndex&)), this,
         SLOT(editSelectedValue(const QModelIndex&))));
   }
Пример #20
0
// Constructor.
qtractorBusForm::qtractorBusForm (
	QWidget *pParent, Qt::WindowFlags wflags )
	: QDialog(pParent, wflags)
{
	// Setup UI struct...
	m_ui.setupUi(this);

	// Window modality (let plugin/tool windows rave around).
	QDialog::setWindowModality(Qt::WindowModal);

	// Initialize locals.
	m_pBus        = NULL;

	m_pAudioRoot  = NULL;
	m_pMidiRoot   = NULL;

	m_iDirtySetup = 0;
	m_iDirtyCount = 0;
	m_iDirtyTotal = 0;

	QHeaderView *pHeader = m_ui.BusListView->header();
	pHeader->setDefaultAlignment(Qt::AlignLeft);
	pHeader->resizeSection(0, 140);
#if QT_VERSION >= 0x050000
//	pHeader->setSectionResizeMode(QHeaderView::Custom);
	pHeader->setSectionResizeMode(1, QHeaderView::ResizeToContents);
	pHeader->setSectionResizeMode(2, QHeaderView::ResizeToContents);
	pHeader->setSectionsMovable(false);
#else
//	pHeader->setResizeMode(QHeaderView::Custom);
	pHeader->setResizeMode(1, QHeaderView::ResizeToContents);
 	pHeader->setResizeMode(2, QHeaderView::ResizeToContents);
	pHeader->setMovable(false);
#endif

	m_ui.BusListView->setContextMenuPolicy(Qt::CustomContextMenu);

	const QColor& rgbDark = palette().dark().color().darker(150);
	m_ui.BusTitleTextLabel->setPalette(QPalette(rgbDark));
	m_ui.BusTitleTextLabel->setAutoFillBackground(true);

	// (Re)initial contents.
	refreshBuses();

	// Try to restore normal window positioning.
	adjustSize();

	// UI signal/slot connections...
	QObject::connect(m_ui.BusListView,
		SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
		SLOT(selectBus()));
	QObject::connect(m_ui.BusListView,
		SIGNAL(customContextMenuRequested(const QPoint&)),
		SLOT(contextMenu(const QPoint&)));
	QObject::connect(m_ui.BusNameLineEdit,
		SIGNAL(textChanged(const QString&)),
		SLOT(changed()));
	QObject::connect(m_ui.BusModeComboBox,
		SIGNAL(activated(int)),
		SLOT(changed()));
	QObject::connect(m_ui.MonitorCheckBox,
		SIGNAL(clicked()),
		SLOT(changed()));
	QObject::connect(m_ui.AudioChannelsSpinBox,
		SIGNAL(valueChanged(int)),
		SLOT(changed()));
	QObject::connect(m_ui.AudioAutoConnectCheckBox,
		SIGNAL(clicked()),
		SLOT(changed()));
	QObject::connect(m_ui.MidiInstrumentComboBox,
		SIGNAL(activated(int)),
		SLOT(changed()));
	QObject::connect(m_ui.MidiSysexPushButton,
		SIGNAL(clicked()),
		SLOT(midiSysex()));

	QObject::connect(m_ui.InputPluginListView,
		SIGNAL(currentRowChanged(int)),
		SLOT(stabilizeForm()));
	QObject::connect(m_ui.InputPluginListView,
		SIGNAL(contentsChanged()),
		SLOT(stabilizeForm()));
	QObject::connect(m_ui.AddInputPluginToolButton,
		SIGNAL(clicked()),
		SLOT(addInputPlugin()));
	QObject::connect(m_ui.RemoveInputPluginToolButton,
		SIGNAL(clicked()),
		SLOT(removeInputPlugin()));
	QObject::connect(m_ui.MoveUpInputPluginToolButton,
		SIGNAL(clicked()),
		SLOT(moveUpInputPlugin()));
	QObject::connect(m_ui.MoveDownInputPluginToolButton,
		SIGNAL(clicked()),
		SLOT(moveDownInputPlugin()));

	QObject::connect(m_ui.OutputPluginListView,
		SIGNAL(currentRowChanged(int)),
		SLOT(stabilizeForm()));
	QObject::connect(m_ui.OutputPluginListView,
		SIGNAL(contentsChanged()),
		SLOT(stabilizeForm()));
	QObject::connect(m_ui.AddOutputPluginToolButton,
		SIGNAL(clicked()),
		SLOT(addOutputPlugin()));
	QObject::connect(m_ui.RemoveOutputPluginToolButton,
		SIGNAL(clicked()),
		SLOT(removeOutputPlugin()));
	QObject::connect(m_ui.MoveUpOutputPluginToolButton,
		SIGNAL(clicked()),
		SLOT(moveUpOutputPlugin()));
	QObject::connect(m_ui.MoveDownOutputPluginToolButton,
		SIGNAL(clicked()),
		SLOT(moveDownOutputPlugin()));

	QObject::connect(m_ui.MoveUpPushButton,
		SIGNAL(clicked()),
		SLOT(moveUpBus()));
	QObject::connect(m_ui.MoveDownPushButton,
		SIGNAL(clicked()),
		SLOT(moveDownBus()));
	QObject::connect(m_ui.CreatePushButton,
		SIGNAL(clicked()),
		SLOT(createBus()));
	QObject::connect(m_ui.UpdatePushButton,
		SIGNAL(clicked()),
		SLOT(updateBus()));
	QObject::connect(m_ui.DeletePushButton,
		SIGNAL(clicked()),
		SLOT(deleteBus()));
	QObject::connect(m_ui.ClosePushButton,
		SIGNAL(clicked()),
		SLOT(reject()));

	stabilizeForm();
}
Пример #21
0
// Constructor.
qtractorMidiControlForm::qtractorMidiControlForm (
	QWidget *pParent, Qt::WindowFlags wflags )
	: QDialog(pParent, wflags)
{
	// Setup UI struct...
	m_ui.setupUi(this);

	// Window modality (let plugin/tool windows rave around).
	QDialog::setWindowModality(Qt::WindowModal);

	m_iDirtyCount = 0;
	m_iDirtyMap = 0;
	m_iUpdating = 0;

	QHeaderView *pHeader = m_ui.FilesListView->header();
	pHeader->setDefaultAlignment(Qt::AlignLeft);
#if QT_VERSION >= 0x050000
//	pHeader->setSectionResizeMode(QHeaderView::Custom);
	pHeader->setSectionResizeMode(QHeaderView::ResizeToContents);
	pHeader->setSectionsMovable(false);
#else
//	pHeader->setResizeMode(QHeaderView::Custom);
	pHeader->setResizeMode(QHeaderView::ResizeToContents);
	pHeader->setMovable(false);
#endif

	pHeader = m_ui.ControlMapListView->header();
	pHeader->setDefaultAlignment(Qt::AlignLeft);
#if QT_VERSION >= 0x050000
//	pHeader->setSectionResizeMode(QHeaderView::Custom);
	pHeader->setSectionResizeMode(QHeaderView::ResizeToContents);
	pHeader->setSectionsMovable(false);
#else
//	pHeader->setResizeMode(QHeaderView::Custom);
	pHeader->setResizeMode(QHeaderView::ResizeToContents);
	pHeader->setMovable(false);
#endif

	m_pControlTypeGroup = new qtractorMidiControlTypeGroup(NULL,
		m_ui.ControlTypeComboBox, m_ui.ParamComboBox, m_ui.ParamTextLabel);

	m_ui.ControlTypeComboBox->setCurrentIndex(3); // Controller (default).

//	m_ui.ChannelComboBox->clear();
	m_ui.ChannelComboBox->addItem("*");
	for (unsigned short iChannel = 0; iChannel < 16; ++iChannel)
		m_ui.ChannelComboBox->addItem(textFromChannel(iChannel));

	const QIcon iconCommand(":/images/itemChannel.png");
//	m_ui.CommandComboBox->clear();
	m_ui.CommandComboBox->addItem(iconCommand,
		qtractorMidiControl::nameFromCommand(qtractorMidiControl::TRACK_GAIN));
	m_ui.CommandComboBox->addItem(iconCommand,
		qtractorMidiControl::nameFromCommand(qtractorMidiControl::TRACK_PANNING));
	m_ui.CommandComboBox->addItem(iconCommand,
		qtractorMidiControl::nameFromCommand(qtractorMidiControl::TRACK_MONITOR));
	m_ui.CommandComboBox->addItem(iconCommand,
		qtractorMidiControl::nameFromCommand(qtractorMidiControl::TRACK_RECORD));
	m_ui.CommandComboBox->addItem(iconCommand,
		qtractorMidiControl::nameFromCommand(qtractorMidiControl::TRACK_MUTE));
	m_ui.CommandComboBox->addItem(iconCommand,
		qtractorMidiControl::nameFromCommand(qtractorMidiControl::TRACK_SOLO));

	m_ui.SyncCheckBox->setChecked(qtractorMidiControl::isSync());

	stabilizeTypeChange();

	refreshFiles();
	adjustSize();

	// UI signal/slot connections...
	QObject::connect(m_ui.FilesListView,
		SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
		SLOT(stabilizeForm()));
	QObject::connect(m_ui.ControlMapListView,
		SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
		SLOT(stabilizeForm()));
	QObject::connect(m_ui.ImportPushButton,
		SIGNAL(clicked()),
		SLOT(importSlot()));
	QObject::connect(m_ui.RemovePushButton,
		SIGNAL(clicked()),
		SLOT(removeSlot()));
	QObject::connect(m_ui.MoveUpPushButton,
		SIGNAL(clicked()),
		SLOT(moveUpSlot()));
	QObject::connect(m_ui.MoveDownPushButton,
		SIGNAL(clicked()),
		SLOT(moveDownSlot()));
	QObject::connect(m_pControlTypeGroup,
		SIGNAL(controlTypeChanged(int)),
		SLOT(typeChangedSlot()));
	QObject::connect(m_pControlTypeGroup,
		SIGNAL(controlParamChanged(int)),
		SLOT(keyChangedSlot()));
	QObject::connect(m_ui.ChannelComboBox,
		SIGNAL(activated(int)),
		SLOT(keyChangedSlot()));
	QObject::connect(m_ui.TrackCheckBox,
		SIGNAL(toggled(bool)),
		SLOT(keyChangedSlot()));
	QObject::connect(m_ui.TrackSpinBox,
		SIGNAL(valueChanged(int)),
		SLOT(valueChangedSlot()));
	QObject::connect(m_ui.CommandComboBox,
		SIGNAL(activated(int)),
		SLOT(valueChangedSlot()));
	QObject::connect(m_ui.FeedbackCheckBox,
		SIGNAL(toggled(bool)),
		SLOT(valueChangedSlot()));
	QObject::connect(m_ui.MapPushButton,
		SIGNAL(clicked()),
		SLOT(mapSlot()));
	QObject::connect(m_ui.UnmapPushButton,
		SIGNAL(clicked()),
		SLOT(unmapSlot()));
	QObject::connect(m_ui.SyncCheckBox,
		SIGNAL(toggled(bool)),
		SLOT(syncSlot(bool)));
	QObject::connect(m_ui.ReloadPushButton,
		SIGNAL(clicked()),
		SLOT(reloadSlot()));
	QObject::connect(m_ui.ExportPushButton,
		SIGNAL(clicked()),
		SLOT(exportSlot()));
	QObject::connect(m_ui.ClosePushButton,
		SIGNAL(clicked()),
		SLOT(reject()));
}
Пример #22
0
//--------------------------------------------------------------------------------------
//! The AIS Safety and DSC distress message page
//--------------------------------------------------------------------------------------
tVesselMessagesTabPage::tVesselMessagesTabPage( int numKeys, bool soleFocus, QWidget* pParent )
: QWidget( pParent ), m_NumKeys(numKeys)
{
    m_pTableTitle = new QLabel( tr( "Messages", "[title]" ), this );
    m_pTableTitle->hide();

    CreateActions();

    m_pMessageTable = new tTableWidget( 0, columnCount, this );
    m_pMessageTable->setFrameShape( QFrame::NoFrame );
    m_pMessageTable->SetSoleFocus( soleFocus );
    m_pMessageTable->SetWrapping( soleFocus == true );
    m_pMessageTable->hideColumn( mmsiColumn );
    m_pMessageTable->hideColumn( sourceTypeColumn );
    m_pMessageTable->hideColumn( uidColumn );
    Connect( m_pMessageTable, SIGNAL( itemClicked( QTableWidgetItem* ) ), m_pDetailsAct, SLOT( trigger() ) );

    QHeaderView* pHorizontalHeaderView = m_pMessageTable->horizontalHeader();
    pHorizontalHeaderView->setClickable( false );
    pHorizontalHeaderView->setResizeMode( timeColumn, QHeaderView::Fixed );
    pHorizontalHeaderView->setResizeMode( messageColumn, QHeaderView::Stretch );

    QString timeString = QString( tr( "Time", "[title]" ) );
    QSize headerTextSize = pHorizontalHeaderView->fontMetrics().size( 0, timeString );
    m_maxTimeWidth = headerTextSize.width() + 10;
    pHorizontalHeaderView->resizeSection( timeColumn, m_maxTimeWidth );

    QStringList headings;
    headings << timeString << tr( "Message", "[title]" );
    m_pMessageTable->setHorizontalHeaderLabels( headings );
    SetHeaderFont();

    // Prevents header bold font
    pHorizontalHeaderView->setHighlightSections( false );
    pHorizontalHeaderView->setDefaultAlignment( Qt::AlignLeft );

    QHeaderView* pVerticalHeaderView = m_pMessageTable->verticalHeader();
    pVerticalHeaderView->hide();
    pVerticalHeaderView->setResizeMode( QHeaderView::Fixed );
    pVerticalHeaderView->setDefaultSectionSize( QFontMetrics( QApplication::font() ).height() * 2 + 10 );

    QVBoxLayout* pVLayout = new QVBoxLayout( this );
    pVLayout->setContentsMargins( 0, 0, 0, 0 );

    pVLayout->addWidget( m_pTableTitle );
    pVLayout->addWidget( m_pMessageTable );

    setLayout( pVLayout );

    m_pResizeTimer = new QTimer( this );
    Connect( m_pResizeTimer, SIGNAL(timeout()), this, SLOT( Resize() ) );

    RefreshTable();
    m_pMessageTable->selectRow( 0 );

    if ( tProductSettings::Instance().AISAllowed() == true )
    {
        tAisEngine* pAisEngine = tGlobal<tAisEngine>::Instance();
        Connect( pAisEngine, SIGNAL( NewSafetyMessage( tAisSafetyMessage ) ), this, SLOT( NewAisSafetyMessage( const tAisSafetyMessage& ) ) );
        Connect( pAisEngine, SIGNAL( RemoveSafetyMessage( int ) ), this, SLOT( RemoveAisSafetyMessage( int ) ) );
    }
Пример #23
0
// Constructor.
qtractorInstrumentForm::qtractorInstrumentForm (
	QWidget *pParent, Qt::WindowFlags wflags )
	: QDialog(pParent, wflags)
{
	// Setup UI struct...
	m_ui.setupUi(this);

	// Window modality (let plugin/tool windows rave around).
	QDialog::setWindowModality(Qt::WindowModal);

	m_pInstruments = NULL;

	m_iDirtyCount = 0;

	QHeaderView *pHeader = m_ui.InstrumentsListView->header();
	pHeader->setDefaultAlignment(Qt::AlignLeft);
#if QT_VERSION >= 0x050000
//	pHeader->setSectionResizeMode(QHeaderView::Custom);
	pHeader->setSectionResizeMode(QHeaderView::ResizeToContents);
	pHeader->setSectionsMovable(false);
#else
//	pHeader->setResizeMode(QHeaderView::Custom);
	pHeader->setResizeMode(QHeaderView::ResizeToContents);
	pHeader->setMovable(false);
#endif

	pHeader = m_ui.FilesListView->header();
	pHeader->setDefaultAlignment(Qt::AlignLeft);
#if QT_VERSION >= 0x050000
//	pHeader->setSectionResizeMode(QHeaderView::Custom);
	pHeader->setSectionResizeMode(QHeaderView::ResizeToContents);
	pHeader->setSectionsMovable(false);
#else
//	pHeader->setResizeMode(QHeaderView::Custom);
	pHeader->setResizeMode(QHeaderView::ResizeToContents);
	pHeader->setMovable(false);
#endif

	pHeader = m_ui.NamesListView->header();
	pHeader->setDefaultAlignment(Qt::AlignLeft);
#if QT_VERSION >= 0x050000
//	pHeader->setSectionResizeMode(QHeaderView::Custom);
	pHeader->setSectionResizeMode(QHeaderView::ResizeToContents);
	pHeader->setSectionsMovable(false);
#else
//	pHeader->setResizeMode(QHeaderView::Custom);
	pHeader->setResizeMode(QHeaderView::ResizeToContents);
	pHeader->setMovable(false);
#endif

	qtractorSession *pSession = qtractorSession::getInstance();
	if (pSession)
		setInstruments(pSession->instruments());

	adjustSize();

	// UI signal/slot connections...
	QObject::connect(m_ui.FilesListView,
		SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
		SLOT(stabilizeForm()));
	QObject::connect(m_ui.NamesListView,
		SIGNAL(itemCollapsed(QTreeWidgetItem*)),
		SLOT(itemCollapsed(QTreeWidgetItem*)));
	QObject::connect(m_ui.NamesListView,
		SIGNAL(itemExpanded(QTreeWidgetItem*)),
		SLOT(itemExpanded(QTreeWidgetItem*)));
	QObject::connect(m_ui.InstrumentsListView,
		SIGNAL(itemCollapsed(QTreeWidgetItem*)),
		SLOT(itemCollapsed(QTreeWidgetItem*)));
	QObject::connect(m_ui.InstrumentsListView,
		SIGNAL(itemExpanded(QTreeWidgetItem*)),
		SLOT(itemExpanded(QTreeWidgetItem*)));
	QObject::connect(m_ui.ImportPushButton,
		SIGNAL(clicked()),
		SLOT(importSlot()));
	QObject::connect(m_ui.RemovePushButton,
		SIGNAL(clicked()),
		SLOT(removeSlot()));
	QObject::connect(m_ui.MoveUpPushButton,
		SIGNAL(clicked()),
		SLOT(moveUpSlot()));
	QObject::connect(m_ui.MoveDownPushButton,
		SIGNAL(clicked()),
		SLOT(moveDownSlot()));
	QObject::connect(m_ui.ReloadPushButton,
		SIGNAL(clicked()),
		SLOT(reloadSlot()));
	QObject::connect(m_ui.ExportPushButton,
		SIGNAL(clicked()),
		SLOT(exportSlot()));
	QObject::connect(m_ui.ClosePushButton,
		SIGNAL(clicked()),
		SLOT(reject()));
}
Пример #24
0
FileDescriptorWidget::FileDescriptorWidget(QWidget* parent) :
   QWidget(parent),
   mpFileDescriptor(NULL),
   mReadOnly(true),
   mModified(false),
   mpTreeWidget(NULL),
   mpFileBrowser(NULL),
   mpGcpGroup(NULL),
   mpGcpTree(NULL)
{
   // Item tree widget
   QStringList columnNames;
   columnNames.append("Item");
   columnNames.append("Value");

   mpTreeWidget = new CustomTreeWidget(this);
   mpTreeWidget->setColumnCount(columnNames.count());
   mpTreeWidget->setHeaderLabels(columnNames);
   mpTreeWidget->setRootIsDecorated(true);
   mpTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
   mpTreeWidget->setGridlinesShown(Qt::Horizontal | Qt::Vertical, true);
   mpTreeWidget->setSortingEnabled(false);

   QHeaderView* pHeader = mpTreeWidget->header();
   if (pHeader != NULL)
   {
      pHeader->setSortIndicatorShown(false);
      pHeader->setMovable(false);
      pHeader->setStretchLastSection(true);
      pHeader->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
      pHeader->resizeSection(0, 150);
   }

   // Band file browser
   mpFileBrowser = new FileBrowser(mpTreeWidget);
   mpFileBrowser->setBrowseCaption("Select Band File");
   mpFileBrowser->hide();

   // GCP group box
   mpGcpGroup = new QGroupBox("Ground Control Points (GCP)", this);

   // GCP tree widget
   columnNames.clear();
   columnNames.append("Name");
   columnNames.append("Column");
   columnNames.append("Row");
   columnNames.append("Latitude");
   columnNames.append("Longitude");

   mpGcpTree = new CustomTreeWidget(mpGcpGroup);
   mpGcpTree->setColumnCount(columnNames.count());
   mpGcpTree->setHeaderLabels(columnNames);
   mpGcpTree->setRootIsDecorated(false);
   mpGcpTree->setSelectionMode(QAbstractItemView::SingleSelection);
   mpGcpTree->setGridlinesShown(Qt::Horizontal | Qt::Vertical, true);
   mpGcpTree->setSortingEnabled(true);

   pHeader = mpGcpTree->header();
   if (pHeader != NULL)
   {
      pHeader->setSortIndicatorShown(true);
      pHeader->setMovable(false);
      pHeader->setStretchLastSection(false);
      pHeader->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
      pHeader->resizeSection(0, 75);
      pHeader->resizeSection(1, 75);
      pHeader->resizeSection(2, 75);
   }

   // Layout
   QVBoxLayout* pGcpLayout = new QVBoxLayout(mpGcpGroup);
   pGcpLayout->setMargin(10);
   pGcpLayout->setSpacing(10);
   pGcpLayout->addWidget(mpGcpTree, 10);

   QVBoxLayout* pLayout = new QVBoxLayout(this);
   pLayout->setMargin(0);
   pLayout->setSpacing(10);
   pLayout->addWidget(mpTreeWidget);
   pLayout->addWidget(mpGcpGroup);

   // Connections
   VERIFYNR(connect(mpTreeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this,
      SLOT(descriptorItemChanged(QTreeWidgetItem*, int))));
}
Пример #25
0
FeatureClassDlg::FeatureClassDlg(QWidget* pParent) :
    QDialog(pParent)
{
    // Classes
    QLabel* pClassLabel = new QLabel("Feature Classes:", this);

    QToolButton* pAddFeatureButton = new QToolButton(this);
    pAddFeatureButton->setAutoRaise(true);
    pAddFeatureButton->setIcon(QIcon(":/icons/New"));
    pAddFeatureButton->setToolTip("Add Feature");

    QToolButton* pRemoveFeatureButton = new QToolButton(this);
    pRemoveFeatureButton->setAutoRaise(true);
    pRemoveFeatureButton->setIcon(QIcon(":/icons/Delete"));
    pRemoveFeatureButton->setToolTip("Remove Feature");

    mpClassList = new QListWidget(this);
    mpClassList->setFixedWidth(150);
    mpClassList->setSelectionMode(QAbstractItemView::SingleSelection);
    mpClassList->setSortingEnabled(true);
    mpClassList->sortItems(Qt::AscendingOrder);

    // Fields
    QLabel* pFieldLabel = new QLabel("Fields:", this);

    QToolButton* pAddFieldButton = new QToolButton(this);
    pAddFieldButton->setAutoRaise(true);
    pAddFieldButton->setIcon(QIcon(":/icons/New"));
    pAddFieldButton->setToolTip("Add Field");

    QToolButton* pRemoveFieldButton = new QToolButton(this);
    pRemoveFieldButton->setAutoRaise(true);
    pRemoveFieldButton->setIcon(QIcon(":/icons/Delete"));
    pRemoveFieldButton->setToolTip("Remove Field");

    QStringList columnNames;
    columnNames.append("Name");
    columnNames.append("Type");
    columnNames.append("Default Value");

    mpFieldTree = new QTreeWidget(this);
    mpFieldTree->setColumnCount(3);
    mpFieldTree->setHeaderLabels(columnNames);
    mpFieldTree->setSelectionMode(QAbstractItemView::SingleSelection);
    mpFieldTree->setRootIsDecorated(false);
    mpFieldTree->setAllColumnsShowFocus(true);
    mpFieldTree->setSortingEnabled(true);
    mpFieldTree->sortByColumn(0, Qt::AscendingOrder);
    mpFieldTree->setItemDelegateForColumn(0, new FieldNameDelegate(mpFieldTree));
    mpFieldTree->setItemDelegateForColumn(1, new FieldTypeDelegate(mpFieldTree));
    mpFieldTree->setItemDelegateForColumn(2, new FieldValueDelegate(mpFieldTree));

    QHeaderView* pHeader = mpFieldTree->header();
    if (pHeader != NULL)
    {
        pHeader->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
        pHeader->setStretchLastSection(false);
        pHeader->setSortIndicatorShown(true);
    }

    // Horizontal line
    QFrame* pLine = new QFrame(this);
    pLine->setFrameStyle(QFrame::HLine | QFrame::Sunken);

    // Dialog buttons
    QDialogButtonBox* pButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
            Qt::Horizontal, this);

    // Layout
    QHBoxLayout* pFeatureButtonLayout = new QHBoxLayout();
    pFeatureButtonLayout->setMargin(0);
    pFeatureButtonLayout->setSpacing(0);
    pFeatureButtonLayout->addWidget(pClassLabel);
    pFeatureButtonLayout->addSpacing(10);
    pFeatureButtonLayout->addStretch();
    pFeatureButtonLayout->addWidget(pAddFeatureButton);
    pFeatureButtonLayout->addWidget(pRemoveFeatureButton);

    QVBoxLayout* pFeatureClassLayout = new QVBoxLayout();
    pFeatureClassLayout->setMargin(0);
    pFeatureClassLayout->setSpacing(2);
    pFeatureClassLayout->addLayout(pFeatureButtonLayout);
    pFeatureClassLayout->addWidget(mpClassList, 10);

    QHBoxLayout* pFieldButtonLayout = new QHBoxLayout();
    pFieldButtonLayout->setMargin(0);
    pFieldButtonLayout->setSpacing(0);
    pFieldButtonLayout->addWidget(pFieldLabel);
    pFieldButtonLayout->addSpacing(10);
    pFieldButtonLayout->addStretch();
    pFieldButtonLayout->addWidget(pAddFieldButton);
    pFieldButtonLayout->addWidget(pRemoveFieldButton);

    QVBoxLayout* pFieldLayout = new QVBoxLayout();
    pFieldLayout->setMargin(0);
    pFieldLayout->setSpacing(2);
    pFieldLayout->addLayout(pFieldButtonLayout);
    pFieldLayout->addWidget(mpFieldTree, 10);

    QGridLayout* pLayout = new QGridLayout(this);
    pLayout->setMargin(10);
    pLayout->setSpacing(10);
    pLayout->addLayout(pFeatureClassLayout, 0, 0);
    pLayout->addLayout(pFieldLayout, 0, 1);
    pLayout->addWidget(pLine, 1, 0, 1, 2);
    pLayout->addWidget(pButtonBox, 2, 0, 1, 2);
    pLayout->setRowStretch(0, 10);
    pLayout->setColumnStretch(1, 10);

    // Initialization
    setWindowTitle("Feature Classes");
    resize(550, 300);
    loadFromSettings();
    updateFields();

    // Connections
    VERIFYNR(connect(pAddFeatureButton, SIGNAL(clicked()), this, SLOT(addFeatureClass())));
    VERIFYNR(connect(pRemoveFeatureButton, SIGNAL(clicked()), this, SLOT(removeFeatureClass())));
    VERIFYNR(connect(mpClassList, SIGNAL(itemChanged(QListWidgetItem*)), this,
                     SLOT(setFeatureClassData(QListWidgetItem*))));
    VERIFYNR(connect(mpClassList, SIGNAL(itemSelectionChanged()), this, SLOT(updateFields())));
    VERIFYNR(connect(pAddFieldButton, SIGNAL(clicked()), this, SLOT(addField())));
    VERIFYNR(connect(pRemoveFieldButton, SIGNAL(clicked()), this, SLOT(removeField())));
    VERIFYNR(connect(mpFieldTree, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this,
                     SLOT(setFieldData(QTreeWidgetItem*, int))));
    VERIFYNR(connect(pButtonBox, SIGNAL(accepted()), this, SLOT(accept())));
    VERIFYNR(connect(pButtonBox, SIGNAL(rejected()), this, SLOT(reject())));
}
Пример #26
0
// Constructor.
qjackctlClientListView::qjackctlClientListView (
	qjackctlConnectView *pConnectView, bool bReadable )
	: QTreeWidget(pConnectView)
{
	m_pConnectView = pConnectView;

	m_pAutoOpenTimer   = 0;
	m_iAutoOpenTimeout = 0;

	m_pDragItem = NULL;
	m_pDragItem = NULL;

	m_pAliases = NULL;
	m_bRenameEnabled = false;

	QHeaderView *pHeader = QTreeWidget::header();
	pHeader->setDefaultAlignment(Qt::AlignLeft);
//	pHeader->setDefaultSectionSize(120);
#if QT_VERSION >= 0x050000
//	pHeader->setSectionResizeMode(QHeaderView::Custom);
	pHeader->setSectionsMovable(false);
	pHeader->setSectionsClickable(true);
#else
//	pHeader->setResizeMode(QHeaderView::Custom);
	pHeader->setMovable(false);
	pHeader->setClickable(true);
#endif
	pHeader->setSortIndicatorShown(true);
	pHeader->setStretchLastSection(true);

	QTreeWidget::setRootIsDecorated(true);
	QTreeWidget::setUniformRowHeights(true);
//	QTreeWidget::setDragEnabled(true);
	QTreeWidget::setAcceptDrops(true);
	QTreeWidget::setDropIndicatorShown(true);
	QTreeWidget::setAutoScroll(true);
	QTreeWidget::setSelectionMode(QAbstractItemView::SingleSelection);
	QTreeWidget::setSizePolicy(
		QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
	QTreeWidget::setSortingEnabled(true);
	QTreeWidget::setMinimumWidth(120);
	QTreeWidget::setColumnCount(1);

	QString sText;
	if (bReadable)
		sText = tr("Readable Clients / Output Ports");
	else
		sText = tr("Writable Clients / Input Ports");
	QTreeWidget::headerItem()->setText(0, sText);
	QTreeWidget::sortItems(0, Qt::AscendingOrder);
	QTreeWidget::setToolTip(sText);

	// Trap for help/tool-tips events.
	QTreeWidget::viewport()->installEventFilter(this);

	QObject::connect(QTreeWidget::itemDelegate(),
		SIGNAL(commitData(QWidget*)),
		SLOT(renamedSlot()));

	setAutoOpenTimeout(800);
}