bool TreeWidgetColumnStretcher::eventFilter(QObject *obj, QEvent *ev)
{
    if (obj == parent())
    {
        if (ev->type() == QEvent::Show)
        {
            QHeaderView *hv = qobject_cast<QHeaderView*>(obj);
            for (int i = 0; i < hv->count(); ++i)
				hv->setSectionResizeMode(i, QHeaderView::Interactive);
        }
        else if (ev->type() == QEvent::Hide)
        {
            QHeaderView *hv = qobject_cast<QHeaderView*>(obj);
            for (int i = 0; i < hv->count(); ++i)
				hv->setSectionResizeMode(i, i == m_columnToStretch ? QHeaderView::Stretch : QHeaderView::ResizeToContents);
        }
        else if (ev->type() == QEvent::Resize)
        {
            QHeaderView *hv = qobject_cast<QHeaderView*>(obj);
            if (hv->sectionResizeMode(m_columnToStretch) == QHeaderView::Interactive)
            {
                QResizeEvent *re = static_cast<QResizeEvent*>(ev);
                int diff = re->size().width() - re->oldSize().width() ;
                hv->resizeSection(m_columnToStretch, qMax(32, hv->sectionSize(1) + diff));
            }
        }
    }
    return false;
}
Пример #2
0
//! Construct the cut list object
TTCutList::TTCutList(QWidget* parent)
  :QWidget(parent)
{
  setupUi( this );

  // not implemented
  pbCutAudio->setEnabled(false);
  
  // set list view header (column) width
  videoCutList->setRootIsDecorated( false );
  QHeaderView* header = videoCutList->header();
  header->resizeSection(0, 200);
  header->resizeSection(1, 120);
  header->resizeSection(2, 120);
  header->resizeSection(3, 120);
  header->resizeSection(4,  80);
  
  // data struct for cut list view
  cutListData   = NULL;
  editItemIndex = -1;
  
  // actions for context menu
  createActions();

  // signal and slot connections
  connect(pbEntryUp,       SIGNAL(clicked()), SLOT(onEntryUp()));
  connect(pbEntryDown,     SIGNAL(clicked()), SLOT(onEntryDown()));
  connect(pbEntryDelete,   SIGNAL(clicked()), SLOT(onEntryDelete()));
  connect(pbPreview,       SIGNAL(clicked()), SLOT(onPreview()));
  connect(pbCutAudioVideo, SIGNAL(clicked()), SLOT(onAVCut()));
  connect(pbCutAudio,      SIGNAL(clicked()), SLOT(onAudioCut()));
  connect(videoCutList,    SIGNAL(itemClicked( QTreeWidgetItem*, int)), SLOT(onEntrySelected(QTreeWidgetItem*, int)));
  connect(videoCutList,    SIGNAL( customContextMenuRequested( const QPoint& ) ), SLOT( onContextMenuRequest( const QPoint& ) ) );
}
// Constructor.
qtractorMidiListView::qtractorMidiListView ( QWidget *pParent )
	: qtractorFileListView(qtractorFileList::Midi, pParent)
{
	QTreeWidget::setColumnCount(qtractorMidiListView::LastColumn + 1);

	QTreeWidgetItem *pHeaderItem = QTreeWidget::headerItem();
	pHeaderItem->setText(qtractorMidiListView::Name, tr("Name"));	
	pHeaderItem->setText(qtractorMidiListView::Format, tr("Fmt"));	
	pHeaderItem->setText(qtractorMidiListView::Tracks, tr("Tracks"));	
	pHeaderItem->setText(qtractorMidiListView::Resolution, tr("tpqn"));
	pHeaderItem->setText(qtractorMidiListView::Path, tr("Path"));	
	pHeaderItem->setText(qtractorMidiListView::LastColumn, QString::null);

	pHeaderItem->setTextAlignment(
		qtractorMidiListView::Format, Qt::AlignRight);
	pHeaderItem->setTextAlignment(
		qtractorMidiListView::Tracks, Qt::AlignRight);
	pHeaderItem->setTextAlignment(
		qtractorMidiListView::Resolution, Qt::AlignRight);

	QHeaderView *pHeader = QTreeWidget::header();
	pHeader->resizeSection(qtractorMidiListView::Name, 160);
	QTreeWidget::resizeColumnToContents(qtractorMidiListView::Format);
	QTreeWidget::resizeColumnToContents(qtractorMidiListView::Tracks);
	QTreeWidget::resizeColumnToContents(qtractorMidiListView::Resolution);
	pHeader->resizeSection(qtractorMidiListView::Path, 160);
}
MusicCloudSharedSongTableWidget::MusicCloudSharedSongTableWidget(QWidget *parent)
    : MusicAbstractTableWidget(parent)
{
    setColumnCount(3);
    QHeaderView *headerview = horizontalHeader();
    headerview->resizeSection(0, 10);
    headerview->resizeSection(1, 251);
    headerview->resizeSection(2, 50);

    m_uploading = false;
    m_openFileWidget = nullptr;
    m_currentUploadIndex = 0;

    MusicUtils::Widget::setTransparent(this, 0);
    verticalScrollBar()->setStyleSheet(MusicUIObject::MScrollBarStyle03);

    m_fileDialog = new MusicCloudFileManagerDialog(this);
    m_networkManager = new QNetworkAccessManager(this);
    m_qnListData = new QNSimpleListData(m_networkManager, this);
    m_qnDeleteData = new QNSimpleDeleteData(m_networkManager, this);
    m_qnUploadData = new QNSimpleUploadData(m_networkManager, this);
    connect(m_qnListData, SIGNAL(receiveFinshed(QNDataItems)), SLOT(receiveDataFinshed(QNDataItems)));
    connect(m_qnDeleteData, SIGNAL(deleteFileFinished(bool)), SLOT(deleteFileFinished(bool)));
    connect(m_qnUploadData, SIGNAL(uploadFileFinished(QString)), SLOT(uploadFileFinished(QString)));
}
Пример #5
0
void ListView::setupGeometry() {

	QPalette pl = palette();
	pl.setColor(QPalette::Base, ODD_LINE_COL);
	pl.setColor(QPalette::AlternateBase, EVEN_LINE_COL);
	setPalette(pl); // does not seem to inherit application paletteAnnotate

	QHeaderView* hv = header();
	hv->setStretchLastSection(true);
#if QT_VERSION < 0x050000
	hv->setResizeMode(LOG_COL, QHeaderView::Interactive);
	hv->setResizeMode(TIME_COL, QHeaderView::Interactive);
	hv->setResizeMode(ANN_ID_COL, QHeaderView::ResizeToContents);
#else
    hv->setSectionResizeMode(LOG_COL, QHeaderView::Interactive);
    hv->setSectionResizeMode(TIME_COL, QHeaderView::Interactive);
    hv->setSectionResizeMode(ANN_ID_COL, QHeaderView::ResizeToContents);
#endif
	hv->resizeSection(GRAPH_COL, DEF_GRAPH_COL_WIDTH);
	hv->resizeSection(LOG_COL, DEF_LOG_COL_WIDTH);
	hv->resizeSection(AUTH_COL, DEF_AUTH_COL_WIDTH);
	hv->resizeSection(TIME_COL, DEF_TIME_COL_WIDTH);

	if (git->isMainHistory(fh))
		hideColumn(ANN_ID_COL);
}
Пример #6
0
/* /////////////////////////////////////////////////////////////////////////////
 * Construct a new TTAudioFileList widget.
 */
TTAudioTreeView::TTAudioTreeView(QWidget* parent)
  :QWidget(parent)
{
  setupUi( this );

  mpAVItem = 0;

  audioListView->setRootIsDecorated(false);
  QHeaderView* header = audioListView->header();
  header->resizeSection(0, 220);
  header->resizeSection(1, 220);
  header->resizeSection(2, 140);
  header->resizeSection(3, 100);
  header->resizeSection(4, 100);
  header->resizeSection(5, 100);
  header->resizeSection(6,  60);

  createActions();

  // signal and slot connections
  connect(pbAudioFileOpen,    SIGNAL(clicked()), SIGNAL(openFile()));
  connect(pbAudioEntryUp,     SIGNAL(clicked()), SLOT(onItemUp()));
  connect(pbAudioEntryDown,   SIGNAL(clicked()), SLOT(onItemDown()));
  connect(pbAudioEntryDelete, SIGNAL(clicked()), SLOT(onRemoveItem()));
  connect(audioListView,      SIGNAL(customContextMenuRequested(const QPoint&)), SLOT( onContextMenuRequest(const QPoint&)));
}
Пример #7
0
/** Constructor */
MessageWidget::MessageWidget(bool controlled, QWidget *parent, Qt::WindowFlags flags)
  : QWidget(parent, flags), toolButtonReply(NULL)
{
	/* Invoke the Qt Designer generated object setup routine */
	ui.setupUi(this);

	isControlled = controlled;
	isWindow = false;
	currMsgFlags = 0;

	connect(ui.msgList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(msgfilelistWidgetCostumPopupMenu(QPoint)));
	connect(ui.expandFilesButton, SIGNAL(clicked()), this, SLOT(togglefileview()));
	connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(getallrecommended()));
	connect(ui.msgText, SIGNAL(anchorClicked(QUrl)), this, SLOT(anchorClicked(QUrl)));
	connect(ui.sendInviteButton, SIGNAL(clicked()), this, SLOT(sendInvite()));

	connect(NotifyQt::getInstance(), SIGNAL(messagesTagsChanged()), this, SLOT(messagesTagsChanged()));
	connect(NotifyQt::getInstance(), SIGNAL(messagesChanged()), this, SLOT(messagesChanged()));

	ui.imageBlockWidget->addButtonAction(tr("Load images always for this message"), this, SLOT(loadImagesAlways()), true);
	ui.msgText->setImageBlockWidget(ui.imageBlockWidget);

	/* hide the Tree +/- */
	ui.msgList->setRootIsDecorated( false );
	ui.msgList->setSelectionMode( QAbstractItemView::ExtendedSelection );

	/* Set header resize modes and initial section sizes */
	QHeaderView * msglheader = ui.msgList->header () ;
	QHeaderView_setSectionResizeModeColumn(msglheader, COLUMN_FILE_NAME, QHeaderView::Interactive);
	QHeaderView_setSectionResizeModeColumn(msglheader, COLUMN_FILE_SIZE, QHeaderView::Interactive);
	QHeaderView_setSectionResizeModeColumn(msglheader, COLUMN_FILE_HASH, QHeaderView::Interactive);

	msglheader->resizeSection (COLUMN_FILE_NAME, 200);
	msglheader->resizeSection (COLUMN_FILE_SIZE, 100);
	msglheader->resizeSection (COLUMN_FILE_HASH, 200);

	QFont font = QFont("Arial", 10, QFont::Bold);
	ui.subjectText->setFont(font);

	ui.toText->setMaximumHeight(ui.toText->fontMetrics().lineSpacing()*1.5);
	ui.ccLabel->setVisible(false);
	ui.ccText->setVisible(false);
	ui.ccText->setMaximumHeight(ui.ccText->fontMetrics().lineSpacing()*1.5);
	ui.bccLabel->setVisible(false);
	ui.bccText->setVisible(false);
	ui.bccText->setMaximumHeight(ui.bccText->fontMetrics().lineSpacing()*1.5);

	ui.tagsLabel->setVisible(false);

	ui.msgText->activateLinkClick(false);

	if (isControlled == false) {
		processSettings("MessageWidget", true);
	}

	ui.dateText-> setText("");
	
	ui.inviteFrame->hide();
}
UpdateCenterImpl::UpdateCenterImpl(Updates *updates, bool autoDownloadAndInstall, QWidget * parent, Qt::WindowFlags f)
		: QDialog(parent, f)
{
	setupUi(this);
	// resize for macosx
#ifndef Q_OS_WIN32
	resize(630, 366);
#endif
	closedByButton = false;
	// version
	lblxVSTVersion->setText(QString(lblxVSTVersion->text()).arg(PROGRAM_VERSION));
	// set update class
	this->updates = updates;
	// configure updates list
	QStringList headers;
	headers << tr(" File ") << tr(" Version ") << tr(" Size ") << tr(" Progress ");
	// add the headers
	lsvUpdates->setHeaderLabels(headers);
	// change headers sizes
	QFontMetrics fm = fontMetrics();
	QHeaderView *header = lsvUpdates->header();
	// resize
	header->resizeSection(1, fm.width(headers.at(0) + "9.99.999 alpha"));
	header->resizeSection(2, fm.width(headers.at(1) + " 1024,99Mb "));
	// configure resize mode
	header->setHighlightSections(false);
	header->setStretchLastSection(false);
    header->setSectionResizeMode(0, QHeaderView::Stretch);
	// set header text aligment
	QTreeWidgetItem * headerItem = lsvUpdates->headerItem();
	headerItem->setTextAlignment(1, Qt::AlignHCenter | Qt::AlignVCenter);
	headerItem->setTextAlignment(2, Qt::AlignRight   | Qt::AlignVCenter);
	headerItem->setTextAlignment(3, Qt::AlignHCenter | Qt::AlignVCenter);
	// fill data
	fillUpdates();
	// signals
	connect(lsvUpdates, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(itemChanged(QTreeWidgetItem*, int)));
	connect(btnCancel, SIGNAL(clicked()), this, SLOT(btnCancelClicked()));
	connect(btnUpdate, SIGNAL(clicked()), this, SLOT(btnUpdateClicked()));
	// updater
	connect(updates, SIGNAL(downloadingUpdate(int, int, int)), this, SLOT(downloadingUpdate(int, int, int)));
	connect(updates, SIGNAL(downloadUpdateFinished(int)), this, SLOT(downloadUpdateFinished(int)));
	connect(updates, SIGNAL(downloadUpdateError(int)), this, SLOT(downloadUpdateError(int)));
	connect(updates, SIGNAL(downloadsFinished()), this, SLOT(downloadsFinished()));
	connect(updates, SIGNAL(readyToInstallUpdates()), this, SLOT(readyToInstallUpdates()));
	connect(updates, SIGNAL(failedToInstallUpdates()), this, SLOT(failedToInstallUpdates()));
	// if auto download & install updates, then...
	if (autoDownloadAndInstall)
	{
		// disable update button
		lsvUpdates->setEnabled(false);
		btnUpdate->setEnabled(false);
		// start automatically to download updates (in 500ms)
		QTimer::singleShot(500, this, SLOT(btnUpdateClicked()));
	}
}
Пример #9
0
void SendUsersTreeWidget::retranslateUi()
{
    QStringList headers;
    headers << tr("Name") << tr("Ip");
    this->setHeaderLabels(headers);
    QFontMetrics fm = fontMetrics();
    QHeaderView *header = this->header();
    header->resizeSection(0, qMax(fm.width(headers.at(0)), fm.width(" login_name  ")) );
    header->resizeSection(1, qMax(fm.width(headers.at(1)), fm.width(" 00.00.00.00 ")));
}
Пример #10
0
MusicFunctionTableWidget::MusicFunctionTableWidget(QWidget *parent)
    : MusicAbstractTableWidget(parent)
{
    QHeaderView *headerview = horizontalHeader();
    headerview->resizeSection(0, 20);
    headerview->resizeSection(1, 20);
    headerview->resizeSection(2, 85);

    setRowCount(3);
    m_listIndex = 0;
}
MusicLrcSearchTableWidget::MusicLrcSearchTableWidget(QWidget *parent)
    : MusicQueryTableWidget(parent)
{
    setColumnCount(5);
    QHeaderView *headerview = horizontalHeader();
    headerview->resizeSection(0, 30);
    headerview->resizeSection(1, 175);
    headerview->resizeSection(2, 148);
    headerview->resizeSection(3, 50);
    headerview->resizeSection(4, 24);
    setTransparent(255);
}
Пример #12
0
/** Constructor */
MessageWidget::MessageWidget(bool controlled, QWidget *parent, Qt::WFlags flags)
: QWidget(parent, flags)
{
	/* Invoke the Qt Designer generated object setup routine */
	ui.setupUi(this);

	isControlled = controlled;
	isWindow = false;
	currMsgFlags = 0;

	connect(ui.msgList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(msgfilelistWidgetCostumPopupMenu(QPoint)));
	connect(ui.expandFilesButton, SIGNAL(clicked()), this, SLOT(togglefileview()));
	connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(getallrecommended()));
	connect(ui.msgText, SIGNAL(anchorClicked(QUrl)), this, SLOT(anchorClicked(QUrl)));

	connect(NotifyQt::getInstance(), SIGNAL(messagesTagsChanged()), this, SLOT(messagesTagsChanged()));
	connect(NotifyQt::getInstance(), SIGNAL(messagesChanged()), this, SLOT(messagesChanged()));

	/* hide the Tree +/- */
	ui.msgList->setRootIsDecorated( false );
	ui.msgList->setSelectionMode( QAbstractItemView::ExtendedSelection );

	/* Set header resize modes and initial section sizes */
	QHeaderView * msglheader = ui.msgList->header () ;
	msglheader->setResizeMode (COLUMN_FILE_NAME, QHeaderView::Interactive);
	msglheader->setResizeMode (COLUMN_FILE_SIZE, QHeaderView::Interactive);
	msglheader->setResizeMode (COLUMN_FILE_HASH, QHeaderView::Interactive);

	msglheader->resizeSection (COLUMN_FILE_NAME, 200);
	msglheader->resizeSection (COLUMN_FILE_SIZE, 100);
	msglheader->resizeSection (COLUMN_FILE_HASH, 200);

	QFont font = QFont("Arial", 10, QFont::Bold);
	ui.subjectText->setFont(font);

	ui.bcclabel->setVisible(false);
	ui.bccText->setVisible(false);
	ui.cclabel->setVisible(false);
	ui.ccText->setVisible(false);

	ui.tagsLabel->setVisible(false);

	if (isControlled == false) {
		processSettings("MessageWidget", true);
	}

	ui.dateText-> setText("");

	/* Hide platform specific features */
#ifdef Q_WS_WIN

#endif
}
StatisticRobotHeaderedWidget::StatisticRobotHeaderedWidget(StatisticRobotView& statisticRobotView)
{
  QStringList headerLabels;
  headerLabels << "Property" << "Value";
  setHeaderLabels(headerLabels, "ll");
  QHeaderView* headerView = getHeaderView();
  headerView->setMinimumSectionSize(70);
  headerView->resizeSection(0, 130);
  headerView->resizeSection(1, 70);
  statisticRobotWidget = new StatisticRobotWidget(statisticRobotView, headerView, this);
  setWidget(statisticRobotWidget);
  connect(getHeaderView(), SIGNAL(sectionResized(int, int, int)), statisticRobotWidget, SLOT(forceUpdate()));
}
Пример #14
0
 SensorHeaderedWidget(SensorView& sensorView, RobotConsole& console)
 {
   QStringList headerLabels;
   headerLabels << "Sensor" << "Value" << "Filtered";
   setHeaderLabels(headerLabels, "lrr");
   QHeaderView* headerView = getHeaderView();
   headerView->setMinimumSectionSize(30);
   headerView->resizeSection(0, 60);
   headerView->resizeSection(1, 50);
   headerView->resizeSection(2, 50);
   sensorWidget = new SensorWidget(sensorView, headerView, this);
   setWidget(sensorWidget);
 }
MusicLrcSearchTableWidget::MusicLrcSearchTableWidget(QWidget *parent)
    : MusicQueryTableWidget(parent)
{
    setColumnCount(5);
    QHeaderView *headerview = horizontalHeader();
    headerview->resizeSection(0, 30);
    headerview->resizeSection(1, 225);
    headerview->resizeSection(2, 193);
    headerview->resizeSection(3, 55);
    headerview->resizeSection(4, 24);
    setTransparent(255);
    connect(m_downLoadManager, SIGNAL(resolvedSuccess()), SIGNAL(resolvedSuccess()));
}
Пример #16
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);
}
MusicLrcSearchTableWidget::MusicLrcSearchTableWidget(QWidget *parent)
    : MusicQueryItemTableWidget(parent)
{
    setColumnCount(7);
    QHeaderView *headerview = horizontalHeader();
    headerview->resizeSection(0, 30);
    headerview->resizeSection(1, 213);
    headerview->resizeSection(2, 181);
    headerview->resizeSection(3, 55);
    headerview->resizeSection(4, 24);
    headerview->resizeSection(5, 24);
    headerview->resizeSection(6, 24);
}
Пример #18
0
void PaletteEditor::on_detailsRadio_clicked()
{
    if (!m_compute)
        return;
    const int w = ui.paletteView->columnWidth(1);
    ui.paletteView->setColumnHidden(2, false);
    ui.paletteView->setColumnHidden(3, false);
    QHeaderView *header = ui.paletteView->header();
    header->resizeSection(1, w / 3);
    header->resizeSection(2, w / 3);
    header->resizeSection(3, w / 3);
    m_compute = false;
    m_paletteModel->setCompute(false);
}
Пример #19
0
void batchWindow::updateColumns()
{
	QHeaderView *headerView = ui->tableWidget->horizontalHeader();
	headerView->setSectionResizeMode(QHeaderView::Interactive);
	headerView->resizeSection(0, 60);
	headerView->resizeSection(1, 40);
	headerView->resizeSection(2, 80);
	headerView->setSectionResizeMode(2, QHeaderView::Stretch);
	headerView->resizeSection(3, 80);
	headerView->resizeSection(4, 80);
	headerView->resizeSection(5, 80);
	ui->tableWidget->resizeColumnToContents(0);
	ui->tableWidget->repaint();
}
Пример #20
0
QWidget* SensorView::createWidget()
{
  HeaderedWidget* widget = new HeaderedWidget();
  QStringList headerLabels;
  headerLabels << "Sensor" << "Value" << "Filtered";
  widget->setHeaderLabels(headerLabels, "lrr");
  QHeaderView* headerView = widget->getHeaderView();
  sensorWidget = new SensorWidget(*this, console, headerView, widget);
  widget->setWidget(sensorWidget);  
  headerView->setMinimumSectionSize(30);
  headerView->resizeSection(0, 60);
  headerView->resizeSection(1, 50);
  headerView->resizeSection(2, 50);
  return widget; 
}
Пример #21
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()));
}
Пример #22
0
bool CFileListView::eventFilter(QObject* target, QEvent* event)
{
	QHeaderView * headerView = header();
	if (target == headerView && event && event->type() == QEvent::Resize && headerView->count() == NumberOfColumns)
	{
		auto resizeEvent = dynamic_cast<QResizeEvent*>(event);
		assert_and_return_r(resizeEvent, false);
		float oldHeaderWidth = 0.0f;
		for (int i = 0; i < headerView->count(); ++i)
			oldHeaderWidth += (float)headerView->sectionSize(i);

		const float newHeaderWidth = (float)resizeEvent->size().width();
		if (oldHeaderWidth <= 0.0f || newHeaderWidth <= 0.0f || oldHeaderWidth == newHeaderWidth)
			return false;

		std::vector<float> relativeColumnSizes(NumberOfColumns, 0.0f);
		for (int i = 0; i < headerView->count(); ++i)
			relativeColumnSizes[i] = headerView->sectionSize(i) / oldHeaderWidth;

		for (int i = 0; i < headerView->count(); ++i)
			headerView->resizeSection(i, (int)(newHeaderWidth * relativeColumnSizes[i] + 0.5f));

		return false;
	}

	return QTreeView::eventFilter(target, event);
}
Пример #23
0
//---------------------------------------------------------------------------
TableDialog::TableDialog(TableModel *tableModel, QWidget *parent) : 
  QDialog(parent) {
  
  // Setup the dialog.

  setupUi(this);
  this->tableModel = tableModel;

  // Setup the table view.

  tableView->setModel(tableModel);
  tableView->hideColumn(3);
  selectModel = tableView->selectionModel();

  QHeaderView *header = tableView->header();
  int len = header->length();

  header->resizeSection(0, 4*len/10);
  header->resizeSection(1, 6*len/10);

  // ...

  connect(upButton, SIGNAL(clicked()), this, SLOT(moveUp()));
  connect(downButton, SIGNAL(clicked()), this, SLOT(moveDown()));
  connect(enableButton, SIGNAL(clicked()), this, SLOT(enable()));
  connect(disableButton, SIGNAL(clicked()), this, SLOT(disable()));
  connect(installButton, SIGNAL(clicked()), this, SLOT(chooseDir()));
}
Пример #24
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);
}
Пример #25
0
void ShortcutsImpl::initTable(MainImpl *main)
{
    QList<QObject*> childrens = main->children();
    QListIterator<QObject*> iterator(childrens);
    int row = 0;

    while( iterator.hasNext() )
    {
        QObject *object = iterator.next();
        QAction *action = qobject_cast<QAction*>(object);

        if (action)
        {
            QString text = action->text().remove("&");

            if ( !text.isEmpty() && !(action->data().toString().contains("Recent|")) )
            {
                QString shortcut = action->shortcut();
                QTableWidgetItem *newItem = new QTableWidgetItem(text);

                newItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
                newItem->setData(Qt::UserRole, addressToVariant(object));
                newItem->setIcon(action->icon());
                table->setRowCount(row+1);
                table->setItem(row, 0, newItem);
                table->setItem(row++, 1, new QTableWidgetItem(shortcut));
            }
        }
        table->sortItems( 0 );
    }

    QHeaderView *header = table->horizontalHeader();
    header->resizeSection( 0, 230 );
    table->verticalHeader()->hide();
}
MusicSongSearchOnlineTableWidget::MusicSongSearchOnlineTableWidget(QWidget *parent)
    : MusicQueryTableWidget(parent), m_audition(nullptr)
{
    setColumnCount(6);
    QHeaderView *headerview = horizontalHeader();
    headerview->resizeSection(0, 30);
    headerview->resizeSection(1, 225);
    headerview->resizeSection(2, 176);
    headerview->resizeSection(3, 50);
    headerview->resizeSection(4, 26);
    headerview->resizeSection(5, 26);
    setTransparent(255);

    m_previousAuditionRow = -1;
    M_CONNECTION->setValue("MusicSongSearchOnlineTableWidget", this);
}
connectionListDialog::connectionListDialog(csv_connection * conn, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::connectionListDialog)
{
    ui->setupUi(this);

    this->conn = conn;

    ui->spinBox->setRange(0, INT_MAX); // set max from the component
    ui->spinBox->setValue(conn->getNumRows());

    connect(ui->spinBox,SIGNAL(valueChanged(int)), this, SLOT(updateValSize(int)));

    this->vModel = new csv_connectionModel();
    this->vModel->setConnection(conn);
    this->ui->tableView->setModel(this->vModel);
    QHeaderView * header = this->ui->tableView->horizontalHeader();
    header->setStretchLastSection(true);
    //header->setResizeMode(0, QHeaderView::Fixed);
    header->resizeSection(0, 80);
    header->resizeSection(1, 80);

    // hide import button if is a pythonscript
    if (this->conn->generator != NULL) {
        this->ui->import_csv->setVisible(false);
        this->ui->tableView->setMinimumWidth(240);
        this->ui->spinBox->setEnabled(false);
    }

    connect(this->ui->import_csv,SIGNAL(clicked()), this, SLOT(importCSV()));
    connect(this->vModel,SIGNAL(setSpinBoxVal(int)), ui->spinBox, SLOT(setValue(int)));
}
//-------------------------------------------------------------------------------------------------
void
BachFolderBrowserTreeView::setupColumns( IniConfig & ini, const BachFolderBrowserTreeView::ColumnStructEx columns [] )
{
	QHeaderView * hdr = header();
	int cnt = 0;
	QStringList labels;
	for( cnt=0; columns[cnt].name; ++cnt );
	QVector<int> indexVec(cnt);
	for( int i=0; i<cnt; i++ ) {
		labels << QString::fromLatin1(columns[i].name);
		indexVec[i] = ini.readInt( columns[i].iniName + QString("Index"), columns[i].defaultPos );
	}
	hdr->setStretchLastSection(false);
	for( int n=0; n<cnt; n++ ) {
		for( int i=0; i<cnt; i++ )
			if( indexVec[i] == n )
				hdr->moveSection( hdr->visualIndex(i), n );
	}
	hdr->resizeSections(QHeaderView::Stretch);
	for( int n=0; n<cnt; n++ ) {
		int size = ini.readInt( columns[n].iniName + QString("Size"), columns[n].defaultSize );
		hdr->resizeSection( n, size==0?columns[n].defaultSize:size );
	}
	for( int n=0; n<cnt; n++ ) {
		bool hidden = ini.readBool( columns[n].iniName + QString("Hidden"), columns[n].defaultHidden );
		hdr->setSectionHidden( n, hidden );
	}
	hdr->setResizeMode( QHeaderView::Interactive );
}
AddTestCasesWizard::AddTestCasesWizard(QWidget *parent) :
    QWizard(parent),
    ui(new Ui::AddTestCasesWizard)
{
    ui->setupUi(this);
    
    ui->fullScore->setValidator(new QIntValidator(1, Settings::upperBoundForFullScore(), this));
    ui->timeLimit->setValidator(new QIntValidator(1, Settings::upperBoundForTimeLimit(), this));
    ui->memoryLimit->setValidator(new QIntValidator(1, Settings::upperBoundForMemoryLimit(), this));
    
    connect(ui->fullScore, SIGNAL(textChanged(QString)),
            this, SLOT(fullScoreChanged(QString)));
    connect(ui->timeLimit, SIGNAL(textChanged(QString)),
            this, SLOT(timeLimitChanged(QString)));
    connect(ui->memoryLimit, SIGNAL(textChanged(QString)),
            this, SLOT(memoryLimitChanged(QString)));
    
    QHeaderView *header = ui->argumentList->horizontalHeader();
    for (int i = 0; i < 3; i ++) {
        header->resizeSection(i, header->sectionSizeHint(i));
    }
    
    connect(ui->inputFilesPattern, SIGNAL(textChanged(QString)),
            this, SLOT(inputFilesPatternChanged(QString)));
    connect(ui->outputFilesPattern, SIGNAL(textChanged(QString)),
            this, SLOT(outputFilesPatternChanged(QString)));
    connect(ui->addArgumentButton, SIGNAL(clicked()),
            this, SLOT(addArgument()));
    connect(ui->deleteArgumentButton, SIGNAL(clicked()),
            this, SLOT(deleteArgument()));
}
Пример #30
0
// the default list mode of QListView handles column widths
// very badly (worse than gtk+) and it's not very flexible.
// so, let's handle column widths outselves.
void FolderViewTreeView::layoutColumns() {
  // qDebug("layoutColumns");
  if(!model())
    return;
  doingLayout_ = true;
  QHeaderView* headerView = header();
  // the width that's available for showing the columns.
  int availWidth = viewport()->contentsRect().width();
  int desiredWidth = 0;

  // get the width that every column want
  int numCols = headerView->count();
  if(numCols > 0) {
    int* widths = new int[numCols]; // array to store the widths every column needs
    int column;
    for(column = 0; column < numCols; ++column) {
      int columnId = headerView->logicalIndex(column);
      // get the size that the column needs
      widths[column] = sizeHintForColumn(columnId);
      // compute the total width needed
      desiredWidth += widths[column];
    }

    int filenameColumn = headerView->visualIndex(FolderModel::ColumnFileName);
    // if the total witdh we want exceeds the available space
    if(desiredWidth > availWidth) {
      // Compute the width available for the filename column
      int filenameAvailWidth = availWidth - desiredWidth + widths[filenameColumn];

      // Compute the minimum acceptable width for the filename column
      int filenameMinWidth = qMin(200, sizeHintForColumn(filenameColumn));

      if (filenameAvailWidth > filenameMinWidth) {
        // Shrink the filename column to the available width
        widths[filenameColumn] = filenameAvailWidth;
      }
      else {
        // Set the filename column to its minimum width
        widths[filenameColumn] = filenameMinWidth;
      }
    }
    else {
      // Fill the extra available space with the filename column
      widths[filenameColumn] += availWidth - desiredWidth;
    }

    // really do the resizing for every column
    for(int column = 0; column < numCols; ++column) {
      headerView->resizeSection(column, widths[column]);
    }
    delete []widths;
  }
  doingLayout_ = false;

  if(layoutTimer_) {
    delete layoutTimer_;
    layoutTimer_ = nullptr;
  }
}