Example #1
0
void CQTs_ChSkillsViewer::initialize(){
    train = new QPushButton(tr("Show only trained"));
    train->setCheckable(true);
    connect(train,SIGNAL(released()),this,SLOT(showOnlyTrained()));
    // grid->addWidget(train,0,0,1,3);
    QVBoxLayout *vl  = new QVBoxLayout();
    vl->addWidget(train);
    QWidget *container = new QWidget();

    QScrollArea *scroll = new QScrollArea();

    scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    int rows=0;// number of rows before the skill list
    QGridLayout *grid = new QGridLayout();




    for (int i = 0; i < eng->skillNum(); ++i) {
        QLabel *tLab = new QLabel(eng->skillData(i).myName());
        tLab->setAlignment(Qt::AlignCenter);
        Labels.push_back(tLab);//[i*8+0] name

        grid->addWidget(tLab,i+rows,0);
        grid->addWidget(tLab= new QLabel("0"),i+rows,1);
        tLab->setAlignment(Qt::AlignCenter);
        Labels.push_back(tLab);//[i*8+1] d20

        tLab->setFrameStyle(QFrame::Panel|QFrame::Raised);
        grid->addWidget(tLab= new QLabel("="),i+rows,2);
        tLab->setAlignment(Qt::AlignCenter);
        Labels.push_back(tLab);

        grid->addWidget(tLab= new QLabel("0"),i+rows,3);
        tLab->setAlignment(Qt::AlignCenter);
        Labels.push_back(tLab);//[i*8+3] abl mod

        grid->addWidget(tLab= new QLabel("+"),i+rows,4);
        tLab->setAlignment(Qt::AlignCenter);
        Labels.push_back(tLab);

        grid->addWidget(tLab= new QLabel("0"),i+rows,5);
        tLab->setAlignment(Qt::AlignCenter);
        Labels.push_back(tLab);//[i*8+5] ranks

        grid->addWidget(tLab= new QLabel("+"),i+rows,6);
        tLab->setAlignment(Qt::AlignCenter);
        Labels.push_back(tLab);

        grid->addWidget(tLab= new QLabel("0"),i+rows,7);
        tLab->setAlignment(Qt::AlignCenter);
        Labels.push_back(tLab);//[i*8+7] var mods
    }
    container->setLayout(grid);
    scroll->setWidget(container);
    scroll->setWidgetResizable(true);
    scroll->setMinimumWidth(300);
    vl->addWidget(scroll);
    setLayout(vl);
}
void SettingsDialog::AddPage(Page id, SettingsPage* page) {
  // Connect page's signals to the settings dialog's signals
  connect(page, SIGNAL(NotificationPreview(OSD::Behaviour,QString,QString)),
                SIGNAL(NotificationPreview(OSD::Behaviour,QString,QString)));
  connect(page, SIGNAL(SetWiimotedevInterfaceActived(bool)),
                SIGNAL(SetWiimotedevInterfaceActived(bool)));

  // Create the list item
  QListWidgetItem* item = new QListWidgetItem(page->windowIcon(),
                                              page->windowTitle());
  ui_->list->addItem(item);

  if (!page->IsEnabled()) {
    item->setFlags(Qt::NoItemFlags);
  }

  // Create a scroll area containing the page
  QScrollArea* area = new QScrollArea;
  area->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  area->setWidget(page);
  area->setWidgetResizable(true);
  area->setFrameShape(QFrame::NoFrame);
  area->setMinimumWidth(page->layout()->minimumSize().width());

  // Add the page to the stack
  ui_->stacked_widget->addWidget(area);

  // Remember where the page is
  PageData data;
  data.index_ = ui_->list->row(item);
  data.scroll_area_ = area;
  data.page_ = page;
  pages_[id] = data;
}
void SettingsDialog::AddPage(Page id, SettingsPage* page) {
  // Create the list item
  QListWidgetItem* item = new QListWidgetItem(page->windowIcon(),
                                              page->windowTitle());
  ui_->list->addItem(item);

  if (!page->IsEnabled()) {
    item->setFlags(Qt::NoItemFlags);
  }

  // Create a scroll area containing the page
  QScrollArea* area = new QScrollArea;
  area->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  area->setWidget(page);
  area->setWidgetResizable(true);
  area->setFrameShape(QFrame::NoFrame);
  area->setMinimumWidth(page->layout()->minimumSize().width());

  // Add the page to the stack
  ui_->stacked_widget->addWidget(area);

  // Remember where the page is
  PageData data;
  data.index_ = ui_->list->row(item);
  data.scroll_area_ = area;
  data.page_ = page;
  pages_[id] = data;
}
Example #4
0
cqts_SkillsEditor::cqts_SkillsEditor(CQTs_Character *selected, CQTs_engine *engine, QWidget *parent):
    QWidget(parent)
{
    eng = engine;
    QWidget* toscroll =  new QWidget();
    QScrollArea *Scroll = new QScrollArea;
    QFormLayout *grid = new QFormLayout();

    newSpinSkills = new QSpinBox* [eng->skillNum()];
    for (int i = 0; i < eng->skillNum(); ++i) {
        newSpinSkills[i] = new QSpinBox();
        newSpinSkills[i]->setValue(selected->getRanks(eng->skillData(i)));
        grid->addRow(eng->skillData(i).myName(),newSpinSkills[i]);
    }

    toscroll->setLayout(grid);
    Scroll->setWidget(toscroll);
    Scroll->setWidgetResizable(true);
    Scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    Scroll->setMinimumWidth(200);

    QVBoxLayout *VLay= new QVBoxLayout();
    VLay->addWidget(Scroll);
    saveBTT = new QPushButton("&Save");
    undoBTT = new QPushButton("&Undo");
    QHBoxLayout *tLay= new QHBoxLayout();
    tLay->addWidget(undoBTT);
    tLay->addWidget(saveBTT);
    VLay->addLayout(tLay);
    setLayout(VLay);

    connect(undoBTT,SIGNAL(clicked()),this,SLOT(close()));
    connect(saveBTT,SIGNAL(clicked()),this,SLOT(update()));
}
/**
 * @brief MapManager::init si occupa di inizializzare il thread che controlla il robot e di fare il setup della GUI
 */
void MapManager::init()
{
    // Creo il thread del robot
    setupRobotManagerThread();

    // Adesso creo la view QML
    QQuickView view;

    QQmlContext* rootContext = view.rootContext();

    // Espongo al modulo QML questa classe, in modo che possa connettere i suoi signal
    rootContext->setContextProperty("window", this);

    // Inserisco come proprietà QML delle costanti che corrispondono alla grandezza della finestra
    rootContext->setContextProperty("WINDOW_WIDTH", WIDTH);
    rootContext->setContextProperty("WINDOW_HEIGHT", HEIGHT);

    //Carico il file base
    view.setSource(QStringLiteral("main.qml"));

    // Finito con i setaggi, mostro la finestra
    view.show();


    // Creo il widget che mostra le immagini della camera del robot durante la rircerca
    QWidget cameraWidget;
    QHBoxLayout *hbox = new QHBoxLayout(&cameraWidget);

    // Aggiungo alla horizontal box la QLabel che conterrà le immagini della camera
    hbox->addWidget(&cameraLabel);

    cameraWidget.show();


    // Creo il widget che mostra le vittime trovate
    QWidget victimsFoundWidget;
    QScrollArea *scrollArea = new QScrollArea();

    layout = new QVBoxLayout(&victimsFoundWidget);

    // setto le proprietà della ScrollArea e la mostro
    scrollArea->setWidget(&victimsFoundWidget);
    scrollArea->setWidgetResizable(true);
    scrollArea->setMinimumWidth(260);
    scrollArea->setMinimumHeight(300);
    scrollArea->show();

    // Avvio il loop della GUI
    QApplication::instance()->exec();
}
Example #6
0
observateurTexte::observateurTexte(Othello * othellier, QPoint  pos) : QLabel(){

	   setWindowTitle("Observateur Texte");
	   this->move(pos.x() + 300, pos.y());
	   Qt::WindowFlags flags = 0;
	   QFont sansFont("Lucida Console", 12);		//police à utiliser
	   sansFont.setWordSpacing(5);
	   flags |= Qt::CustomizeWindowHint;
	   flags |= Qt::WindowTitleHint;
	   setWindowFlags(flags);
	   this->setMinimumWidth(650);
	   this->setFont(sansFont);						//défini la police


	   QHBoxLayout *horizontalLayout;
	   QScrollArea *scrollArea;
	   QWidget *scrollAreaWidgetContents;
	   QVBoxLayout *verticalLayout;

	   horizontalLayout = new QHBoxLayout(this);
       horizontalLayout->setSpacing(6);
       horizontalLayout->setContentsMargins(11, 11, 11, 11);
       horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
       vuePlateau = new QLabel(this);
       vuePlateau->setObjectName(QString::fromUtf8("vuePlateau"));
       horizontalLayout->addWidget(vuePlateau);
       scrollArea = new QScrollArea(this);
       //scrollArea->setFixedWidth(185);
       scrollArea->setMinimumWidth(185);
       scrollArea->setObjectName(QString::fromUtf8("scrollArea"));
       scrollArea->setWidgetResizable(true);
       scrollAreaWidgetContents = new QWidget();
       scrollAreaWidgetContents->setObjectName(QString::fromUtf8("scrollAreaWidgetContents"));
       scrollAreaWidgetContents->setGeometry(QRect(0, 0, 285, 642));
       verticalLayout = new QVBoxLayout(scrollAreaWidgetContents);
       verticalLayout->setSpacing(6);
       verticalLayout->setContentsMargins(11, 11, 11, 11);
       verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
       listeCoups = new QLabel(scrollAreaWidgetContents);
       listeCoups->setObjectName(QString::fromUtf8("listeCoups"));
       listeCoups->setAlignment(Qt::AlignLeft|Qt::AlignTop);
       verticalLayout->addWidget(listeCoups);
       scrollArea->setWidget(scrollAreaWidgetContents);
       vuePlateau->raise();
       listeCoups->raise();
       horizontalLayout->addWidget(scrollArea);

	   oth = othellier;
}
QTransferFunctionEditorByValues::QTransferFunctionEditorByValues(QWidget *parent)
 : QTransferFunctionEditor(parent)
{
    setupUi(this);

    // Creem una scroll area per si hi ha molts intervals (no es pot crear des del Qt Designer)

    QScrollArea *scrollArea = new QScrollArea(this);
    qobject_cast<QBoxLayout*>(this->layout())->insertWidget(1, scrollArea);

    m_intervalEditorsWidget = new QWidget(scrollArea);
    QBoxLayout *layout = new QVBoxLayout(m_intervalEditorsWidget);
    m_intervalEditorsLayout = new QVBoxLayout();
    layout->addLayout(m_intervalEditorsLayout);
    layout->addStretch();
    layout->setMargin(0);

    scrollArea->setWidget(m_intervalEditorsWidget);
    scrollArea->setWidgetResizable(true);
    scrollArea->setFrameShape(QFrame::NoFrame);

    // Creem el primer interval

    QTransferFunctionIntervalEditor *first = new QTransferFunctionIntervalEditor(m_intervalEditorsWidget);
    first->setIsFirst(true);
    first->setIsLast(true);
    first->setObjectName("interval0");
    m_intervalEditorsLayout->addWidget(first);

    connect(first, SIGNAL(startChanged(int)), SLOT(markAsChanged()));
    connect(first, SIGNAL(endChanged(int)), SLOT(markAsChanged()));
    connect(first, SIGNAL(colorChanged(const QColor&)), SLOT(markAsChanged()));

    // Mida mínima de la scroll area
    QStyle *style = scrollArea->style();
    int scrollBarWidth = style->pixelMetric(QStyle::PM_ScrollBarExtent);
    scrollArea->setMinimumWidth(first->minimumSizeHint().width() + scrollBarWidth);

    m_numberOfIntervals = 1;

    m_changed = true;

    connect(m_addPushButton, SIGNAL(clicked()), SLOT(addInterval()));
    connect(m_removePushButton, SIGNAL(clicked()), SLOT(removeInterval()));
    connect(m_nameLineEdit, SIGNAL(textChanged(const QString&)), SLOT(markAsChanged()));
}
Example #8
0
ContentDialog::ContentDialog(SettingsWidget* settingsWidget, QWidget* parent)
    : ActivateDialog(parent, Qt::Window)
    , activeChatroomWidget(nullptr)
    , settingsWidget(settingsWidget)
    , videoSurfaceSize(QSize())
    , videoCount(0)
{
    QVBoxLayout* boxLayout = new QVBoxLayout(this);
    boxLayout->setMargin(0);
    boxLayout->setSpacing(0);

    splitter = new QSplitter(this);
    setStyleSheet(Style::getStylesheet(":/ui/contentDialog/contentDialog.css"));
    splitter->setHandleWidth(6);

    QWidget *friendWidget = new QWidget();
    friendWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    friendWidget->setAutoFillBackground(true);

    friendLayout = new FriendListLayout();
    friendLayout->setMargin(0);
    friendLayout->setSpacing(0);
    friendWidget->setLayout(friendLayout);

    onGroupchatPositionChanged(Settings::getInstance().getGroupchatPosition());

    QScrollArea *friendScroll = new QScrollArea(this);
    friendScroll->setMinimumWidth(220);
    friendScroll->setFrameStyle(QFrame::NoFrame);
    friendScroll->setLayoutDirection(Qt::RightToLeft);
    friendScroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    friendScroll->setStyleSheet(Style::getStylesheet(":/ui/friendList/friendList.css"));
    friendScroll->setWidgetResizable(true);
    friendScroll->setWidget(friendWidget);

    QWidget* contentWidget = new QWidget(this);
    contentWidget->setAutoFillBackground(true);
    contentLayout = new ContentLayout(contentWidget);
    contentLayout->setMargin(0);
    contentLayout->setSpacing(0);

    splitter->addWidget(friendScroll);
    splitter->addWidget(contentWidget);
    splitter->setStretchFactor(1, 1);
    splitter->setCollapsible(1, false);
    boxLayout->addWidget(splitter);

    connect(splitter, &QSplitter::splitterMoved, this, &ContentDialog::saveSplitterState);

    connect(settingsWidget, &SettingsWidget::groupchatPositionToggled, this, &ContentDialog::onGroupchatPositionChanged);

    setMinimumSize(500, 220);
    setAttribute(Qt::WA_DeleteOnClose);

    QByteArray geometry = Settings::getInstance().getDialogGeometry();

    if (!geometry.isNull())
        restoreGeometry(geometry);
    else
        resize(720, 400);


    QByteArray splitterState = Settings::getInstance().getDialogSplitterState();

    if (!splitterState.isNull())
        splitter->restoreState(splitterState);

    currentDialog = this;

    setAcceptDrops(true);

    new QShortcut(Qt::CTRL + Qt::Key_Q, this, SLOT(close()));
    new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Tab, this, SLOT(previousContact()));
    new QShortcut(Qt::CTRL + Qt::Key_Tab, this, SLOT(nextContact()));
    new QShortcut(Qt::CTRL + Qt::Key_PageUp, this, SLOT(previousContact()));
    new QShortcut(Qt::CTRL + Qt::Key_PageDown, this, SLOT(nextContact()));

    connect(Core::getInstance(), &Core::usernameSet, this, &ContentDialog::updateTitleAndStatusIcon);

    Translator::registerHandler(std::bind(&ContentDialog::retranslateUi, this), this);
}
Example #9
0
MeshifyPopup::MeshifyPopup()
	: DVGui::Dialog(TApp::instance()->getMainWindow(), true, false, "MeshifyPopup"), m_r(-1), m_c(-1)
{
	setWindowTitle(tr("Create Mesh"));
	setLabelWidth(0);
	setModal(false);

	setTopMargin(0);
	setTopSpacing(0);

	beginVLayout();

	QSplitter *splitter = new QSplitter(Qt::Vertical);
	splitter->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
	addWidget(splitter);

	endVLayout();

	//------------------------- Top Layout --------------------------

	QScrollArea *scrollArea = new QScrollArea(splitter);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	scrollArea->setWidgetResizable(true);
	scrollArea->setMinimumWidth(450);
	splitter->addWidget(scrollArea);
	splitter->setStretchFactor(0, 1);

	QFrame *topWidget = new QFrame(scrollArea);
	scrollArea->setWidget(topWidget);

	QGridLayout *topLayout = new QGridLayout(topWidget); // Needed to justify at top
	topWidget->setLayout(topLayout);

	//------------------------- Parameters --------------------------

	int row = 0;

	QLabel *edgesLengthLabel = new QLabel(tr("Mesh Edges Length:"));
	topLayout->addWidget(edgesLengthLabel, row, 0, Qt::AlignRight | Qt::AlignVCenter);

	m_edgesLength = new DVGui::MeasuredDoubleField;
	m_edgesLength->setMeasure("length.x");
	m_edgesLength->setRange(0.0, 1.0); // In inches (standard unit)
	m_edgesLength->setValue(0.2);

	topLayout->addWidget(m_edgesLength, row++, 1);

	QLabel *rasterizationDpiLabel = new QLabel(tr("Rasterization DPI:"));
	topLayout->addWidget(rasterizationDpiLabel, row, 0, Qt::AlignRight | Qt::AlignVCenter);

	m_rasterizationDpi = new DVGui::DoubleLineEdit;
	m_rasterizationDpi->setRange(1.0, (std::numeric_limits<double>::max)());
	m_rasterizationDpi->setValue(300.0);

	topLayout->addWidget(m_rasterizationDpi, row++, 1);

	QLabel *shapeMarginLabel = new QLabel(tr("Mesh Margin (pixels):"));
	topLayout->addWidget(shapeMarginLabel, row, 0, Qt::AlignRight | Qt::AlignVCenter);

	m_margin = new DVGui::IntLineEdit;
	m_margin->setRange(2, (std::numeric_limits<int>::max)());
	m_margin->setValue(5);

	topLayout->addWidget(m_margin, row++, 1);

	connect(m_edgesLength, SIGNAL(valueChanged(bool)), this, SLOT(onParamsChanged(bool)));
	connect(m_rasterizationDpi, SIGNAL(editingFinished()), this, SLOT(onParamsChanged()));
	connect(m_margin, SIGNAL(editingFinished()), this, SLOT(onParamsChanged()));

	topLayout->setRowStretch(row, 1);

	//------------------------- View Widget -------------------------

	// NOTE: It's IMPORTANT that parent widget is supplied. It's somewhat
	// used by QSplitter to decide the initial widget sizes...

	m_viewer = new Swatch(splitter);
	m_viewer->setMinimumHeight(150);
	m_viewer->setFocusPolicy(Qt::WheelFocus);

	splitter->addWidget(m_viewer);

	//--------------------------- Buttons ---------------------------

	m_okBtn = new QPushButton(tr("Apply"));
	addButtonBarWidget(m_okBtn);

	connect(m_okBtn, SIGNAL(clicked()), this, SLOT(apply()));

	// Finally, acquire current selection
	onCellSwitched();

	m_viewer->resize(0, 350);
	resize(600, 700);
}
AdjustLevelsPopup::AdjustLevelsPopup()
	: DVGui::Dialog(TApp::instance()->getMainWindow(), true, false, "AdjustLevels"), m_thresholdD(0.005) //0.5% of the image size
{
	int i, j;

	setWindowTitle(tr("Adjust Levels"));
	setLabelWidth(0);
	setModal(false);

	setTopMargin(0);
	setTopSpacing(0);

	beginVLayout();

	QSplitter *splitter = new QSplitter(Qt::Vertical);
	splitter->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
	addWidget(splitter);

	endVLayout();

	//------------------------- Top Layout --------------------------

	QScrollArea *scrollArea = new QScrollArea(splitter);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	scrollArea->setWidgetResizable(true);
	scrollArea->setMinimumWidth(450);
	splitter->addWidget(scrollArea);
	splitter->setStretchFactor(0, 1);

	QFrame *topWidget = new QFrame(scrollArea);
	scrollArea->setWidget(topWidget);

	QVBoxLayout *topVLayout = new QVBoxLayout(topWidget); //Needed to justify at top
	topWidget->setLayout(topVLayout);

	QHBoxLayout *topLayout = new QHBoxLayout(topWidget);
	topVLayout->addLayout(topLayout);
	topVLayout->addStretch(1);

	//------------------------- Histogram ---------------------------

	m_histogram = new Histogram(topWidget);
	topLayout->addWidget(m_histogram);

	//------------------------- Mark Bars ---------------------------

	MarksBar *histogramMarksBar, *colorBarMarksBar;
	QVBoxLayout *histogramViewLayout;

	for (i = 0; i < 5; ++i) {
		HistogramView *view = m_histogram->getHistograms()->getHistogramView(i);
		histogramViewLayout = static_cast<QVBoxLayout *>(view->layout());

		//Don't draw channel numbers
		view->channelBar()->setDrawNumbers(false);

		for (j = 0; j < 2; ++j) {
			EditableMarksBar *editableMarksBar = m_marksBar[j + (i << 1)] = new EditableMarksBar;
			MarksBar *marksBar = editableMarksBar->marksBar();

			//Set margins up to cover the histogram
			editableMarksBar->layout()->setContentsMargins(6, 0, 5, 0);
			connect(editableMarksBar, SIGNAL(paramsChanged()), this, SLOT(onParamsChanged()));

			histogramViewLayout->insertWidget(1 + (j << 1), editableMarksBar);
		}
	}

	//------------------------- View Widget -------------------------

	//NOTE: It's IMPORTANT that parent widget is supplied. It's somewhat
	//used by QSplitter to decide the initial widget sizes...

	m_viewer = new Swatch(splitter);
	m_viewer->setMinimumHeight(150);
	m_viewer->setFocusPolicy(Qt::WheelFocus);
	splitter->addWidget(m_viewer);

	//--------------------------- Buttons ---------------------------

	QVBoxLayout *buttonsLayout = new QVBoxLayout(topWidget);
	topLayout->addLayout(buttonsLayout);

	buttonsLayout->addSpacing(50);

	QPushButton *clampRange = new QPushButton(tr("Clamp"), topWidget);
	clampRange->setMinimumSize(65, 25);
	buttonsLayout->addWidget(clampRange);
	connect(clampRange, SIGNAL(clicked(bool)), this, SLOT(clampRange()));

	QPushButton *autoAdjust = new QPushButton(tr("Auto"), topWidget);
	autoAdjust->setMinimumSize(65, 25);
	buttonsLayout->addWidget(autoAdjust);
	connect(autoAdjust, SIGNAL(clicked(bool)), this, SLOT(autoAdjust()));

	QPushButton *resetBtn = new QPushButton(tr("Reset"), topWidget);
	resetBtn->setMinimumSize(65, 25);
	buttonsLayout->addWidget(resetBtn);
	connect(resetBtn, SIGNAL(clicked(bool)), this, SLOT(reset()));

	buttonsLayout->addStretch(1);

	m_okBtn = new QPushButton(tr("Apply"));
	addButtonBarWidget(m_okBtn);

	connect(m_okBtn, SIGNAL(clicked()), this, SLOT(apply()));

	//Finally, acquire current selection
	acquireRaster();

	m_viewer->resize(0, 350);
	resize(600, 700);
}