コード例 #1
1
void tst_QStackedWidget::dynamicPages()
{
    QStackedWidget *sw = new QStackedWidget;

    TestPage *w1 = new TestPage(true);
    w1->setN(3);

    TestPage *w2 = new TestPage;
    w2->setN(3);

    sw->addWidget(w1);
    sw->addWidget(w2);

    QLineEdit *le11 = w1->findChild<QLineEdit*>(QLatin1String("lineEdit1"));
    le11->setFocus();   // set focus to second widget in the page
    sw->resize(200, 200);
    sw->show();
    qApp->setActiveWindow(sw);
    QTest::qWaitForWindowActive(sw);
    QTRY_COMPARE(QApplication::focusWidget(), le11);

    sw->setCurrentIndex(1);
    QLineEdit *le22 = w2->findChild<QLineEdit*>(QLatin1String("lineEdit2"));
    le22->setFocus();
    QTRY_COMPARE(QApplication::focusWidget(), le22);
    // Going back should move focus back to le11
    sw->setCurrentIndex(0);
    QTRY_COMPARE(QApplication::focusWidget(), le11);

}
コード例 #2
0
ファイル: revsview.cpp プロジェクト: abhijit86k/QGit
void RevsView::setTabLogDiffVisible(bool b) {

	QStackedWidget* s = tab()->stackedPanes;
	QTabWidget* t = tab()->tabLogDiff;

	bool isTabPage = (s->currentIndex() == 0);
	int idx = (isTabPage ? t->currentIndex() : s->currentIndex());

	container->setUpdatesEnabled(false);

	if (b && !isTabPage) {

		t->addTab(tab()->textBrowserDesc, "Log");
		t->addTab(tab()->textEditDiff, "Diff");

		t->setCurrentIndex(idx - 1);
		s->setCurrentIndex(0);
	}
	if (!b && isTabPage) {

		s->addWidget(tab()->textBrowserDesc);
		s->addWidget(tab()->textEditDiff);

		// manually remove the two remaining empty pages
		t->removeTab(0); t->removeTab(0);

		s->setCurrentIndex(idx + 1);
	}
	container->setUpdatesEnabled(true);
}
コード例 #3
0
ファイル: mainwindow.cpp プロジェクト: Tymolc/CG-I-2015
MainWindow::MainWindow(QWidget *parent, QFlag flags) :
	QMainWindow(parent, flags)
{
    // Set window title
    setWindowTitle("3D Computergrafik I - SS2015 - Aufgabenblatt 4");

    // Create main container
    QWidget *container = new QWidget();
    setCentralWidget(container);

    // Add list (on the left)
    QListWidget *list = new QListWidget(container);
    list->addItem("Aufgabe 12");
    list->addItem("Aufgabe 13");
    list->addItem("Aufgabe 14");
    list->setMaximumWidth(150);

    // Add stack of exercise windows (on the right)
    QStackedWidget *stack = new QStackedWidget(container);

    // Add exercises to widget
    stack->addWidget(new GLViewer(new Exercise12()));
    stack->addWidget(new GLViewer(new Exercise13()));
    stack->addWidget(new GLViewer(new Exercise14()));

    // Create layout
    QHBoxLayout *layout = new QHBoxLayout;
    layout->addWidget(list);
    layout->addWidget(stack);
    container->setLayout(layout);

    // Connect selection-event of list to select the current visible window
    connect(list, SIGNAL(currentRowChanged(int)), stack, SLOT(setCurrentIndex(int)));
}
コード例 #4
0
Widget::Widget(QWidget *parent)
    : QWidget(parent)
{
//! [0]
    QWidget *firstPageWidget = new QWidget;
    QWidget *secondPageWidget = new QWidget;
    QWidget *thirdPageWidget = new QWidget;

    QStackedWidget *stackedWidget = new QStackedWidget;
    stackedWidget->addWidget(firstPageWidget);
    stackedWidget->addWidget(secondPageWidget);
    stackedWidget->addWidget(thirdPageWidget);

//! [0] //! [1]
    QComboBox *pageComboBox = new QComboBox;
    pageComboBox->addItem(tr("Page 1"));
    pageComboBox->addItem(tr("Page 2"));
    pageComboBox->addItem(tr("Page 3"));
    connect(pageComboBox, SIGNAL(activated(int)),
            stackedWidget, SLOT(setCurrentIndex(int)));

//! [1] //! [2]
    QVBoxLayout *layout = new QVBoxLayout;
//! [2]
    layout->addWidget(pageComboBox);
//! [3]
    layout->addWidget(stackedWidget);
    setLayout(layout);
//! [3]
}
コード例 #5
0
Dialog::Dialog( QWidget *parent ) : QDialog( parent )
{
	//ui.setupUi( this );
	QLabel *Label1 = new QLabel( tr( "Label1" ) );
	QLabel *Label2 = new QLabel( tr( "Label2" ) );
	QLabel *Label3 = new QLabel( tr( "Label3" ) );

	QListWidget *list = new QListWidget( this );
	list->insertItem( 0, tr( "Window1" ) );
	list->insertItem( 1, tr( "Window2" ) );
	list->insertItem( 2, tr( "Window3" ) );

	QStackedWidget *stack = new QStackedWidget( this );
	stack->addWidget( Label1 );
	stack->addWidget( Label2 );
	stack->addWidget( Label3 );

	QHBoxLayout *Layout = new QHBoxLayout( this );
	Layout->setMargin( 5 );
	Layout->setSpacing( 5 );
	Layout->addWidget( list );
	Layout->addWidget( stack, 0, Qt::AlignHCenter );
	Layout->setStretchFactor( list, 1 );
	Layout->setStretchFactor( stack, 3 );
	connect( list, SIGNAL( currentRowChanged( int ) ), stack, SLOT( setCurrentIndex( int ) ) );
}
コード例 #6
0
ファイル: main.cpp プロジェクト: KubaO/stackoverflown
int main(int argc, char *argv[])
{
   QApplication a(argc, argv);
   std::random_device rd;
   random_engine gen(rd());

   int imageSize = 300;
   QList<QImage> images;
   for (int n = 0; n < 28; ++n) images << randomImage(imageSize, gen);
   std::uniform_int_distribution<> dImage(0, images.size()-1);

   QStackedWidget display;
   QPushButton ready("I'm Ready!");
   QLabel label, labelHidden;
   display.addWidget(&ready);
   display.addWidget(&label);
   display.addWidget(&labelHidden);

   QTimer splashTimer;
   QStateMachine machine;
   QState s1(&machine), s2(&machine), s3(&machine), s4(&machine);
   splashTimer.setSingleShot(true);

   QObject::connect(&s1, &QState::entered, [&]{
      display.setCurrentWidget(&ready);
      ready.setDefault(true);
      ready.setFocus();
   });
   s1.addTransition(&ready, "clicked()", &s2);

   QObject::connect(&s2, &QState::entered, [&]{
      label.setPixmap(QPixmap::fromImage(images.at(dImage(gen))));
      display.setCurrentWidget(&label);
      splashTimer.start(250 + std::uniform_int_distribution<>(1500, 3000)(gen));
   });
   s2.addTransition(&splashTimer, "timeout()", &s3);

   QObject::connect(&s3, &QState::entered, [&]{
      display.setCurrentWidget(&labelHidden);
      splashTimer.start(2000);
   });
   s3.addTransition(&splashTimer, "timeout()", &s4);

   QObject::connect(&s4, &QState::entered, [&]{
      display.setCurrentWidget(&label);
      splashTimer.start(3000);
   });
   s4.addTransition(&splashTimer, "timeout()", &s1);

   machine.setInitialState(&s1);
   machine.start();
   display.show();

   return a.exec();
}
コード例 #7
0
ファイル: main.cpp プロジェクト: SirYacc/ter
int main( int argc, char *argv[] )
{

    QApplication a( argc, argv );

    QMainWindow mainWindow;

    HGRSVM svm = HGRSVM();
    svm.train( 100 );

    QStackedWidget *stackedWidget = new QStackedWidget;

    MyMainWindow *myMainWindow = new MyMainWindow( stackedWidget );

    stackedWidget->addWidget( myMainWindow );
    stackedWidget->setCurrentWidget( myMainWindow );

    mainWindow.setCentralWidget(stackedWidget);
    mainWindow.setWindowTitle( "Hand gesture recognition for ArDrone" );
    mainWindow.resize(950, 500);
    mainWindow.show();

    thread th1( runArdrone );


    int status = a.exec();



    order = 1;
 th1.join();

    return status;
}
コード例 #8
0
int QStackedWidgetProto::addWidget(QWidget *widget)
{
  QStackedWidget *item = qscriptvalue_cast<QStackedWidget*>(thisObject());
  if (item)
    return item->addWidget(widget);
  return -1;
}
コード例 #9
0
void
InsertPageCommand::execute()
{
    KFormDesigner::Container *container = m_form->objectTree()->lookup(m_containername)->container();
    QWidget *parent = m_form->objectTree()->lookup(m_parentname)->widget();
    if (m_name.isEmpty()) {
        m_name = container->form()->objectTree()->generateUniqueName(
                     container->form()->library()->displayName("QWidget").toLatin1(),
                     /*!numberSuffixRequired*/false);
    }

    QWidget *page = container->form()->library()->createWidget(
        "QWidget", parent, m_name.toLatin1(), container);
    page->setAutoFillBackground(true);
//    page->setPaletteBackgroundColor(Qt::red);
    KFormDesigner::ObjectTreeItem *item = container->form()->objectTree()->lookup(m_name);

    QByteArray classname = parent->metaObject()->className();
    if (classname == "KFDTabWidget") {
        TabWidgetBase *tab = dynamic_cast<TabWidgetBase*>(parent);
        QString n = i18n("Page %1", tab->count() + 1);
        tab->addTab(page, n);
        tab->setCurrentWidget(page);
        item->addModifiedProperty("title", n);
    } else if (classname == "QStackedWidget" || /* compat */ classname == "QWidgetStack") {
        QStackedWidget *stack = dynamic_cast<QStackedWidget*>(parent);
        stack->addWidget(page);
        stack->setCurrentWidget(page);
        item->addModifiedProperty("stackIndex", stack->indexOf(page));
    }
}
コード例 #10
0
void PagePalette::startMasterPageMode(QString masterPage)
{
	m_view->Deselect(true);

	QStackedWidget* stackedWidget = this->stackedWidget();
	if (stackedWidget->count() < 2)
	{
		PagePalette_MasterPages* mpWidget = new PagePalette_MasterPages(stackedWidget, m_view, masterPage);
		mpWidget->setObjectName(QString::fromLocal8Bit("PagePalette_MasterPages"));
		stackedWidget->addWidget(mpWidget);

		connect(mpWidget, SIGNAL(removePage(int )), m_scMW, SLOT(deletePage2(int )));
		connect(mpWidget, SIGNAL(finished())      , m_scMW, SLOT(manageMasterPagesEnd()));
	}
	else
	{
		ScribusDoc* doc = m_view->Doc;
		PagePalette_MasterPages* mpWidget = this->masterpageWidget();
		if (mpWidget->currentView != m_view)
			mpWidget->setView(m_view, masterPage);
		mpWidget->updateMasterPageList(masterPage);
		if (doc->currentPage()->pageName() != masterPage)
			mpWidget->selectMasterPage(masterPage);
	}

	// Set focus to page palette or focus may be set to wrong document window
	this->setFocus();
	stackedWidget->setCurrentIndex(1);
}
コード例 #11
0
ファイル: SplitGrid2.cpp プロジェクト: Wushaowei001/NAF
void SplitGrid2::setCell(QWidget * w, int row, int col)
{
    Q_ASSERT( w != 0 );

    QStackedWidget* cell = getCellImp( row, col );
    Q_ASSERT( cell != 0 );
    if( cell->count() > 0 )
        cell->removeWidget( cell->widget(0) );
    cell->addWidget( w );
}
コード例 #12
0
QT_BEGIN_NAMESPACE

FontSettingsDialog::FontSettingsDialog(QWidget *parent)
    : QDialog(parent)
    , m_windowFontPanel(new FontPanel(this))
    , m_browserFontPanel(new FontPanel(this))
    , m_dialogButtonBox(new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel))
{
    setModal(true);
    setWindowTitle(tr("Font Settings"));
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);

    QVBoxLayout *mainVLayout = new QVBoxLayout(this);
    QHBoxLayout *hboxLayout = new QHBoxLayout;
    mainVLayout->addLayout(hboxLayout);

    QLabel *label = new QLabel(tr("Font settings for:"), this);
    label->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
    hboxLayout->addWidget(label);
    QComboBox *comboBox = new QComboBox(this);
    comboBox->addItem(tr("Browser"));
    comboBox->addItem(tr("Application"));
    hboxLayout->addWidget(comboBox);

    m_windowFontPanel->setCheckable(true);
    m_browserFontPanel->setCheckable(true);

    const QString customSettings(tr("Use custom settings"));
    m_windowFontPanel->setTitle(customSettings);
    m_browserFontPanel->setTitle(customSettings);

    QStackedWidget *stackWidget = new QStackedWidget(this);
    stackWidget->addWidget(m_browserFontPanel);
    stackWidget->addWidget(m_windowFontPanel);

    mainVLayout->addWidget(stackWidget);
    mainVLayout->addWidget(m_dialogButtonBox);

    connect(m_dialogButtonBox , SIGNAL(rejected()), this, SLOT(reject()));
    connect(m_dialogButtonBox , SIGNAL(accepted()), this, SLOT(accept()));
    connect(comboBox, SIGNAL(activated(int)), stackWidget, SLOT(setCurrentIndex(int)));
}
コード例 #13
0
ファイル: input.cpp プロジェクト: leiradel/RetroArch
QWidget *UserBindsPage::widget()
{
   unsigned p, retro_id;
   unsigned max_users    = *(input_driver_get_uint(INPUT_ACTION_MAX_USERS));
   QWidget *widget       = new QWidget;
   QGridLayout *layout   = new QGridLayout;
   QComboBox *userCombo  = new QComboBox;
   QStackedWidget *stack = new QStackedWidget;

   for (p = 0; p < max_users; p++)
   {
      userCombo->addItem(QString::number(p));

      QWidget *uWidget = new QWidget();
      FormLayout *form = new FormLayout();

      for (retro_id = 0; retro_id < RARCH_FIRST_CUSTOM_BIND + 20; retro_id++)
      {
         char descriptor[300];
         const struct retro_keybind *keybind   = 
            &input_config_binds[p][retro_id];
         const struct retro_keybind *auto_bind = 
            (const struct retro_keybind*)
            input_config_get_bind_auto(p, retro_id);

         input_config_get_bind_string(descriptor,
            keybind, auto_bind, sizeof(descriptor));

         const struct retro_keybind *keyptr =
            &input_config_binds[p][retro_id];

         QString label = msg_hash_to_str(keyptr->enum_idx);

         form->addRow(QString(msg_hash_to_str(keyptr->enum_idx)),
               new QPushButton(QString(descriptor)));
      }

      uWidget->setLayout(form);

      stack->addWidget(uWidget);
   }

   connect(userCombo, SIGNAL(activated(int)),
         stack, SLOT(setCurrentIndex(int)));

   layout->addWidget(userCombo, 0, 0);
   layout->addWidget(stack, 1, 0);

   widget->setLayout(layout);

   return widget;
}
コード例 #14
0
ファイル: main.cpp プロジェクト: vanessaorgua/Linovitsa
int main(int argc,char **argv)
{
    QApplication app(argc,argv);

    QCoreApplication::setOrganizationName("Rabitsa");
    QCoreApplication::setApplicationName("filters");
    QApplication::setStyle(new QPlastiqueStyle);

    QSettings s;
    
    IoNetClient net( s.value("/ioserv/hostname","localhost").toString());
    net.setCmode(
#ifdef WIN32
                false
#else
                s.value("/ioserv/cmode",true).toBool()
#endif
    );
    QStackedWidget main;
    QColor cl;
    QPalette pal;
    cl.setRgb(90,132,201);
    pal.setColor(QPalette::Background,cl);
    main.setPalette(pal);

    QTranslator translator;
    translator.load("filters_"+QLocale::system().name(),":/translate");
    app.installTranslator(&translator);

    QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
    
    mMainForm *mainForm = new mMainForm(net);
    
    main.addWidget(mainForm);
    main.setCurrentWidget(mainForm);


    if(QApplication::desktop()->size().width()>1366 && QApplication::desktop()->size().height()> 768)
    {
        main.resize(1366,768);
        main.show();
    }
    else
    {
        main.showFullScreen();
    }

    return app.exec();
}
コード例 #15
0
ファイル: treegui_funcs.cpp プロジェクト: alinelena/aten
// Create new page (only in Tab widget or Stack widget)
QtWidgetObject* AtenTreeGuiDialog::addPage(TreeGuiWidget* widget, TreeGuiWidget* parentWidget, QString label)
{
	// Grab widget object...
	QtWidgetObject* wo = parentWidget->qtWidgetObject();
	if (wo == NULL)
	{
		printf("Internal Error: Can't add page to tabwidget since supplied tabwidget doesn't have an associated QtWidgetObject.\n");
		return NULL;
	}

	// Create new page widget and layout
	QWidget* pageWidget = new QWidget(this);
	QGridLayout *layout = addLayout(pageWidget);

	// Create widget object to return
	QtWidgetObject* qtwo = widgetObjects_.add();
	qtwo->set(widget, pageWidget, NULL, layout);
	pageWidget->setEnabled(widget->enabled());
	pageWidget->setVisible(widget->visible());
	pageWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

	// Cast parent widget into correct type, and add page
	if (parentWidget->type() == TreeGuiWidget::TabWidget)
	{
		// Cast QWidget in parentWidget into QTabWidget
		QTabWidget *tabs = static_cast<QTabWidget*>(wo->qWidget());
		if (!tabs)
		{
			printf("Internal Error: Couldn't cast QWidget into QTabWidget.\n");
			return NULL;
		}
		int id = tabs->addTab(pageWidget, label);
	}
	else if (parentWidget->type() == TreeGuiWidget::StackWidget)
	{
		// Cast QWidget in parentWidget into QStackedWidget
		QStackedWidget *stack = static_cast<QStackedWidget*>(wo->qWidget());
		if (!stack)
		{
			printf("Internal Error: Couldn't cast QWidget into QStackedWidget.\n");
			return NULL;
		}
		int id = stack->addWidget(pageWidget);
	}
	else printf("Internal Error: Tried to add a page into a widget type (%s) that doesn't support it.\n", TreeGuiWidget::widgetType(widget->type()));

	return qtwo;
}
コード例 #16
0
void PropertyWidgetBuilder::visitAdvancedList(AdvancedListProperty & property)
{
    QComboBox * comboBox = new QComboBox(m_active_widget);
    comboBox->addItems(property.choices());

    m_active_layout->addRow(property.description(), comboBox);
    
    QStackedWidget * groupBoxesStack = new QStackedWidget(m_active_widget);
    m_active_layout->addRow(groupBoxesStack);

    for (PropertyList * propertyList : property.propertyLists()) {
        QGroupBox * groupBox = new QGroupBox(m_active_widget);
        groupBox->setAlignment(Qt::AlignVCenter);
        QFormLayout * groupboxlayout = new QFormLayout(groupBox);
        
        if (propertyList->isEmpty()) {
            QLabel * label = new QLabel("No Properties to display", groupBox);
            label->setAlignment(Qt::AlignCenter);
            groupboxlayout->addWidget(label);
        }
        
        
        QWidget * former_active_widget = m_active_widget;
        QFormLayout * former_active_layout = m_active_layout;
        
        m_active_widget = groupBox;
        m_active_layout = groupboxlayout;
        
        this->iterateOverProperties(propertyList->list());
        
        m_active_widget = former_active_widget;
        m_active_layout = former_active_layout;
        
        groupBoxesStack->addWidget(groupBox);
    }

    QObject::connect(comboBox, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
        [&property, groupBoxesStack] (const QString & text) {
            property.select(text);
            groupBoxesStack->setCurrentIndex(property.selection());
        
            qDebug("Set Property %s = \"%s\"",
                   qPrintable(property.name()),
                   qPrintable(property.selectedChoice()));
        }
    );
}
コード例 #17
0
void PagePalette::startMasterPageMode(QString masterPage)
{
	ScribusDoc* doc = m_view->Doc;
	
	bool mustDeselect = false;
	mustDeselect |= (!doc->masterPageMode());
	mustDeselect |= (doc->masterPageMode() && doc->currentPage()->pageName() != masterPage);
	if (mustDeselect)
	{
		// We must avoid deselecting directly if doc is in an edit mode,
		// otherwise that would cause an inconsistent state. In such case,
		// fallback to normal mode by precaution
		if (doc->appMode != modeNormal)
			m_view->requestMode(modeNormal);
		m_view->Deselect(true);
	}

	QStackedWidget* stackedWidget = this->stackedWidget();
	if (stackedWidget->count() < 2)
	{
		PagePalette_MasterPages* mpWidget = new PagePalette_MasterPages(stackedWidget, m_view, masterPage);
		mpWidget->setObjectName(QString::fromLocal8Bit("PagePalette_MasterPages"));
		stackedWidget->addWidget(mpWidget);

		connect(mpWidget, SIGNAL(removePage(int )), m_scMW, SLOT(deletePage2(int )));
		connect(mpWidget, SIGNAL(finished())      , m_scMW, SLOT(editMasterPagesEnd()));
	}
	else
	{
		ScribusDoc* doc = m_view->Doc;
		PagePalette_MasterPages* mpWidget = this->masterpageWidget();
		if (mpWidget->m_view != m_view)
			mpWidget->setView(m_view, masterPage);
		mpWidget->updateMasterPageList(masterPage);
		if (doc->currentPage()->pageName() != masterPage)
			mpWidget->selectMasterPage(masterPage);
	}

	// Set focus to page palette or focus may be set to wrong document window
	this->setFocus();
	stackedWidget->setCurrentIndex(1);
}
コード例 #18
0
PagePalette::PagePalette(QWidget* parent) : ScDockPalette(parent, "PagePalette", 0)
{
	m_scMW = (ScribusMainWindow*) parent;
	m_view = 0;

	setObjectName(QString::fromLocal8Bit("PagePalette"));

	QStackedWidget* stackedWidget = new QStackedWidget(this);
	stackedWidget->setObjectName(QString::fromLocal8Bit("stackedWidget"));

	PagePalette_Pages* pageWidget = new PagePalette_Pages(stackedWidget);
	pageWidget->setObjectName(QString::fromLocal8Bit("PagePalette_Pages"));
	stackedWidget->addWidget(pageWidget);

	setWidget(stackedWidget);

	connect(pageWidget, SIGNAL(gotoMasterPage(QString)), m_scMW, SLOT(editMasterPagesStart(QString)));
	
	Rebuild();
	languageChange();
}
コード例 #19
0
//-----------------------------------------------------------------------------
// Function: ComponentEditorSettingsPage::createWorkspacePages()
//-----------------------------------------------------------------------------
QStackedWidget* ComponentEditorSettingsPage::createWorkspacePages(QString currentWorkspaceName, 
	QStringList workspaceNames)
{
	SettingsPage::settings().beginGroup("Workspaces");

	SettingsPage::settings().beginGroup(currentWorkspaceName + "/ComponentEditorFilters/HW/Flat");
	QStringList hwCheckBoxNames = SettingsPage::settings().childKeys();
	SettingsPage::settings().endGroup(); // workspaceName/ComponentEditorFilters/HW

	SettingsPage::settings().beginGroup(currentWorkspaceName + "/ComponentEditorFilters/SW");
	QStringList swCheckBoxNames = SettingsPage::settings().childKeys();
	SettingsPage::settings().endGroup(); // workspaceName/ComponentEditorFilters/SW

	SettingsPage::settings().endGroup(); // Workspaces
	
	QStringList hierarchyNames = getHierarchyNames();
	hwCheckBoxNames = changeNameSeparators(hwCheckBoxNames);
	swCheckBoxNames = changeNameSeparators(swCheckBoxNames);
	QStackedWidget* workspaces = new QStackedWidget;

	for (int workspaceIndex = 0; workspaceIndex < workspaceNames.size(); ++workspaceIndex)
	{
	    QTableWidget* hwTable = new QTableWidget (hwCheckBoxNames.size(), hierarchyNames.size(), this);
		setHwTable(hwTable, hierarchyNames, hwCheckBoxNames, workspaceIndex);

		QTableWidget* swTable = new QTableWidget (swCheckBoxNames.size(), 1, this);
		QStringList swHeader("Global");
		setSwTable(swTable, swHeader, swCheckBoxNames, workspaceIndex);
		
		QTabWidget* wareTab = new QTabWidget;
	    wareTab->addTab(hwTable, "Hardware");
    	wareTab->addTab(swTable, "Software");

		workspaces->addWidget(wareTab);
	}

	return (workspaces);
}
コード例 #20
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    auto *proxyStyle = new TabBarProxyStyle;
    app.setStyle(proxyStyle);

    QWidget widget;
    QStackedWidget stackedWidget;
    QTabBar tabBar;
    tabBar.setDocumentMode(true);
    tabBar.setTabsClosable(true);
    tabBar.setMovable(true);
    tabBar.setExpanding(false);

    // top
    tabBar.setShape(QTabBar::RoundedNorth);
    // bottom
//    tabBar.setShape(QTabBar::RoundedSouth);
    // left
//    tabBar.setShape(QTabBar::RoundedWest);
    // right
//    tabBar.setShape(QTabBar::RoundedEast);

    const auto shortLabel = QStringLiteral("Tab %1");
    const auto longLabel = QStringLiteral("An Extremely Long Tab Label %1");

    QMap<int, QWidget*> tabs;
    for (int i = 0; i < TabCount; i++) {
        QString tabNumberString = QString::number(i);
        QLabel *label = new QLabel(QStringLiteral("Tab %1 content").arg(tabNumberString));
        tabs[i] = label;
        label->setAlignment(Qt::AlignCenter);
        stackedWidget.addWidget(label);
        tabBar.addTab(shortLabel.arg(tabNumberString));
    }

    QObject::connect(&tabBar, &QTabBar::tabMoved, [&tabs](int from, int to) {
        QWidget *thisWidget = tabs[from];
        QWidget *thatWidget = tabs[to];
        tabs[from] = thatWidget;
        tabs[to] = thisWidget;
    });

    QObject::connect(&tabBar, &QTabBar::currentChanged, [&stackedWidget, &tabs](int index) {
        if (index >= 0)
            stackedWidget.setCurrentWidget(tabs[index]);
    });

    QObject::connect(&tabBar, &QTabBar::tabCloseRequested, [&stackedWidget, &tabBar, &tabs](int index) {
        QWidget *widget = tabs[index];
        tabBar.removeTab(index);
        for (int i = index + 1; i < TabCount; i++)
            tabs[i-1] = tabs[i];
        int currentIndex = tabBar.currentIndex();
        if (currentIndex >= 0)
            stackedWidget.setCurrentWidget(tabs[currentIndex]);
        delete widget;
    });

    QLayout *layout;
    switch (tabBar.shape()) {
    case QTabBar::RoundedEast:
    case QTabBar::TriangularEast:
        tabBar.setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
        layout = new QHBoxLayout(&widget);
        layout->addWidget(&stackedWidget);
        layout->addWidget(&tabBar);
        break;
    case QTabBar::RoundedWest:
    case QTabBar::TriangularWest:
        tabBar.setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
        layout = new QHBoxLayout(&widget);
        layout->addWidget(&tabBar);
        layout->addWidget(&stackedWidget);
        break;
    case QTabBar::RoundedNorth:
    case QTabBar::TriangularNorth:
        tabBar.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
        layout = new QVBoxLayout(&widget);
        layout->addWidget(&tabBar);
        layout->addWidget(&stackedWidget);
        break;
    case QTabBar::RoundedSouth:
    case QTabBar::TriangularSouth:
        tabBar.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
        layout = new QVBoxLayout(&widget);
        layout->addWidget(&stackedWidget);
        layout->addWidget(&tabBar);
        break;
    }

    TabBarForm form;
    layout->addWidget(&form);
    layout->setAlignment(&form, Qt::AlignHCenter);

    form.ui->documentModeButton->setChecked(tabBar.documentMode());
    QObject::connect(form.ui->documentModeButton, &QCheckBox::toggled, [&] {
        tabBar.setDocumentMode(form.ui->documentModeButton->isChecked());
        // QMacStyle (and maybe other styles) requires a re-polish to get the right font
        QApplication::sendEvent(&tabBar, new QEvent(QEvent::ThemeChange));
    });

    form.ui->movableTabsButton->setChecked(tabBar.isMovable());
    QObject::connect(form.ui->movableTabsButton, &QCheckBox::toggled, [&] {
        tabBar.setMovable(form.ui->movableTabsButton->isChecked());
        tabBar.update();
    });

    form.ui->closableTabsButton->setChecked(tabBar.tabsClosable());
    QObject::connect(form.ui->closableTabsButton, &QCheckBox::toggled, [&] {
        tabBar.setTabsClosable(form.ui->closableTabsButton->isChecked());
        tabBar.update();
    });

    form.ui->expandingTabsButton->setChecked(tabBar.expanding());
    QObject::connect(form.ui->expandingTabsButton, &QCheckBox::toggled, [&] {
        tabBar.setExpanding(form.ui->expandingTabsButton->isChecked());
        tabBar.update();
    });

    form.ui->displayIconButton->setChecked(!tabBar.tabIcon(0).isNull());
    QObject::connect(form.ui->displayIconButton, &QCheckBox::toggled, [&] {
        const auto icon = form.ui->displayIconButton->isChecked() ?
                          tabBar.style()->standardIcon(QStyle::SP_ComputerIcon) : QIcon();
        for (int i = 0; i < tabBar.count(); i++)
            tabBar.setTabIcon(i, icon);
    });

    form.ui->longLabelButton->setChecked(false);
    QObject::connect(form.ui->longLabelButton, &QCheckBox::toggled, [&] {
        const auto &label = form.ui->longLabelButton->isChecked() ? longLabel : shortLabel;
        for (int i = 0; i < tabBar.count(); i++)
            tabBar.setTabText(i, label.arg(i));
    });

    QObject::connect(form.ui->shapeComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), [&](int index) {
        Q_UNUSED(index);
        // TODO
    });

    if (proxyStyle->alignment == Qt::AlignLeft)
        form.ui->leftAlignedButton->setChecked(true);
    else if (proxyStyle->alignment == Qt::AlignRight)
        form.ui->rightAlignedButton->setChecked(true);
    else
        form.ui->centeredButton->setChecked(true);
    QObject::connect(form.ui->textAlignmentGroup, QOverload<QAbstractButton *>::of(&QButtonGroup::buttonClicked), [&](QAbstractButton *b) {
        proxyStyle->alignment = b == form.ui->leftAlignedButton ? Qt::AlignLeft :
                                b == form.ui->rightAlignedButton ? Qt::AlignRight : Qt::AlignCenter;
        QApplication::sendEvent(&tabBar, new QEvent(QEvent::StyleChange));
    });

    layout->setMargin(12);
    widget.show();

    return app.exec();
}
コード例 #21
0
QDockWidget *TikzCommandInserter::getDockWidget(QWidget *parent)
{
	QDockWidget *tikzDock = new QDockWidget(parent);
	tikzDock->setObjectName("CommandsDock");
	tikzDock->setAllowedAreas(Qt::AllDockWidgetAreas);
	tikzDock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
	tikzDock->setWindowTitle(m_tikzSections.title);
	tikzDock->setWhatsThis(tr("<p>This is a list of TikZ "
	                          "commands.  You can insert these commands in your code by "
	                          "clicking on them.  You can obtain more commands by "
	                          "changing the category in the combo box.</p>"));

	QAction *focusTikzDockAction = new QAction(parent);
	focusTikzDockAction->setShortcut(QKeySequence(tr("Alt+I")));
	tikzDock->addAction(focusTikzDockAction);
	connect(focusTikzDockAction, SIGNAL(triggered()), tikzDock, SLOT(setFocus()));

	QLabel *commandsComboLabel = new QLabel(tr("Category:"));
	ComboBox *commandsCombo = new ComboBox;
	commandsCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
	QStackedWidget *commandsStack = new QStackedWidget;
	connect(commandsCombo, SIGNAL(currentIndexChanged(int)), commandsStack, SLOT(setCurrentIndex(int)));

	QListWidget *tikzListWidget = new QListWidget;
	addListWidgetItems(tikzListWidget, m_tikzSections, false); // don't add children
	tikzListWidget->setMouseTracking(true);
	connect(tikzListWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(setListStatusTip(QListWidgetItem*)));
	connect(tikzListWidget, SIGNAL(itemEntered(QListWidgetItem*)), this, SLOT(setListStatusTip(QListWidgetItem*)));
	connect(tikzListWidget, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(insertTag(QListWidgetItem*)));
//	connect(tikzListWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(insertTag(QListWidgetItem*)));
	commandsCombo->addItem(tr("General"));
	commandsStack->addWidget(tikzListWidget);

	for (int i = 0; i < m_tikzSections.children.size(); ++i)
	{
		QListWidget *tikzListWidget = new QListWidget;
		addListWidgetItems(tikzListWidget, m_tikzSections.children.at(i));
		tikzListWidget->setMouseTracking(true);
		connect(tikzListWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(setListStatusTip(QListWidgetItem*)));
		connect(tikzListWidget, SIGNAL(itemEntered(QListWidgetItem*)), this, SLOT(setListStatusTip(QListWidgetItem*)));
		connect(tikzListWidget, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(insertTag(QListWidgetItem*)));
//		connect(tikzListWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(insertTag(QListWidgetItem*)));

		QString comboItemText = m_tikzSections.children.at(i).title;
		commandsCombo->addItem(comboItemText.remove('&'));
		commandsStack->addWidget(tikzListWidget);
	}

	QGridLayout *tikzLayout = new QGridLayout;
	tikzLayout->addWidget(commandsComboLabel, 0, 0);
	tikzLayout->addWidget(commandsCombo, 0, 1);
	tikzLayout->addWidget(commandsStack, 1, 0, 1, 2);
	tikzLayout->setMargin(5);

	TikzCommandWidget *tikzWidget = new TikzCommandWidget;
	tikzWidget->setLayout(tikzLayout);
	tikzDock->setWidget(tikzWidget);
	tikzDock->setFocusProxy(commandsCombo);

	return tikzDock;
}
コード例 #22
0
ファイル: qtodomanager.cpp プロジェクト: xiaojianwu/QtDeskTop
void QTodoManager::initUI()
{
    QGridLayout *grid = new QGridLayout(this);
    QWidget *closew = new QWidget(this);
    IconButton *closeB = QAppUtils::ref().getCloseIconBtn(closew);
    QHBoxLayout *hlay = new QHBoxLayout(closew);

    QWidget *tipw = new QWidget(this);
    QVBoxLayout *tiplay = new QVBoxLayout(tipw);
    m_lbtip = new QLabel(tipw);
    tiplay->addWidget(m_lbtip);
    m_lbtip->setText(LOCAL("当前位置>>"));

    hlay->addWidget(closeB);
    connect(closeB,SIGNAL(clicked()),this,SLOT(close()));
    m_stacked =   new QStackedWidget(this);
    m_wid_alldo = new QToDoContent(this);//QWinFactory::ref().createWindow(QWinFactory::Widget);
    m_wid_alldo->setTitle(QStringList()<<LOCAL("所有事项")<<LOCAL("选择"));

    m_wid_todo =  new QToDoContent(this,QToDoContent::ToDo);//QWinFactory::ref().createWindow(QWinFactory::Widget);
    m_wid_todo->setTitle(QStringList()<<LOCAL("待办事项")<<LOCAL("选择"));

    m_wid_done =  new QToDoContent(this,QToDoContent::Done);//QWinFactory::ref().createWindow(QWinFactory::Widget);
    m_wid_done->setTitle(QStringList()<<LOCAL("已办事项")<<LOCAL("选择"));

    m_wid_alldo->flushData(QToDoData::ref().getAll());
    //按钮
    m_allcando = new QPureColorButton(this);
    m_todobtn  = new QPureColorButton(this);
    m_donebtn  = new QPureColorButton(this);

    m_allcando->setButtonText(LOCAL("全部事项"));
    m_todobtn->setButtonText(LOCAL("待办事项"));
    m_donebtn->setButtonText(LOCAL("已办事项"));

    m_allcando->setIndex(ALLTask);
    m_todobtn->setIndex(ToDoTask);
    m_donebtn->setIndex(DoneTask);

    connect(m_allcando,SIGNAL(clicked(int)),this,SLOT(stack_change(int)));
    connect(m_todobtn,SIGNAL(clicked(int)),this,SLOT(stack_change(int)));
    connect(m_donebtn,SIGNAL(clicked(int)),this,SLOT(stack_change(int)));

    m_allcando->setColors(QColor(0,0,100),QColor(0,200,200)
                          ,QColor(0,100,100),QColor(0,150,150));

    m_todobtn->setColors(QColor(0,0,100),QColor(0,200,200)
                          ,QColor(0,100,100),QColor(0,150,150));
    m_donebtn->setColors(QColor(0,0,100),QColor(0,200,200)
                          ,QColor(0,100,100),QColor(0,150,150));

    QStackedWidget *stacked = m_stacked;
    stacked->setContentsMargins(0,0,0,0);
    stacked->addWidget(m_wid_alldo);
    stacked->addWidget(m_wid_todo);
    stacked->addWidget(m_wid_done);

    grid->setSpacing(5);
    grid->setContentsMargins(0,0,0,10);
    grid->addWidget(tipw,0,0,1,1);
    grid->addWidget(closew,0,2,1,1,Qt::AlignRight);
    grid->addWidget(stacked,1,0,1,3);
    grid->addWidget(m_allcando,2,0,1,1);
    grid->addWidget(m_todobtn,2,1,1,1);
    grid->addWidget(m_donebtn,2,2,1,1);

}
コード例 #23
0
ExportOptionsDlg::ExportOptionsDlg(ExporterResource& pExporter, QWidget* pParent) :
   QDialog(pParent),
   mpExporter(pExporter),
   mpTabWidget(NULL),
   mpSubsetPage(NULL),
   mpExporterPage(NULL)
{
   // Options widget
   QStackedWidget* pStack = new QStackedWidget(this);

   // Subset page
   RasterElement* pRasterElement = dynamic_cast<RasterElement*>(mpExporter->getItem());
   RasterFileDescriptor* pRasterWholeCubeFileDescriptor = NULL;
   RasterDataDescriptor* pRasterOrgDataDescriptor = NULL;
   if (pRasterElement != NULL)
   {
      pRasterOrgDataDescriptor = dynamic_cast<RasterDataDescriptor*>(pRasterElement->getDataDescriptor());
      if (pRasterOrgDataDescriptor != NULL)
      {
         // we are creating a file descriptor for export from the original cube, because the SubsetWidget
         // uses DimensionDescriptor::operator= compare's to determine selection which dictate that on-disk,
         // original and active numbers need to be identical, this guarantees that DimensionDescriptors will
         // compare correctly.
         pRasterWholeCubeFileDescriptor = dynamic_cast<RasterFileDescriptor*>(
            RasterUtilities::generateFileDescriptorForExport(pRasterOrgDataDescriptor, "foobar"));
      }
   }
   RasterFileDescriptor* pRasterFileDescriptor = dynamic_cast<RasterFileDescriptor*>(mpExporter->getFileDescriptor());
   if ((pRasterFileDescriptor != NULL) && (pRasterWholeCubeFileDescriptor != NULL) &&
      (pRasterOrgDataDescriptor != NULL))
   {
      mpSubsetPage = new SubsetWidget();
      mpSubsetPage->setExportMode(true);

      // Rows
      const vector<DimensionDescriptor>& orgRows = pRasterWholeCubeFileDescriptor->getRows();
      const vector<DimensionDescriptor>& selectedRows = pRasterFileDescriptor->getRows();
      mpSubsetPage->setRows(orgRows, selectedRows);

      // Columns
      const vector<DimensionDescriptor>& orgColumns = pRasterWholeCubeFileDescriptor->getColumns();
      const vector<DimensionDescriptor>& selectedColumns = pRasterFileDescriptor->getColumns();
      mpSubsetPage->setColumns(orgColumns, selectedColumns);

      // Bands
      const vector<DimensionDescriptor>& orgBands = pRasterWholeCubeFileDescriptor->getBands();
      const vector<DimensionDescriptor>& selectedBands = pRasterFileDescriptor->getBands();
      vector<string> bandNames = RasterUtilities::getBandNames(pRasterOrgDataDescriptor);
      mpSubsetPage->setBands(orgBands, bandNames, selectedBands);

      // Initial bad band file directory
      QString strDirectory;

      string filename = pRasterFileDescriptor->getFilename();
      if (filename.empty() == false)
      {
         QFileInfo fileInfo(QString::fromStdString(filename));
         strDirectory = fileInfo.absolutePath();
      }

      mpSubsetPage->setBadBandFileDirectory(strDirectory);
   }

   // Exporter page
   if (mpExporter->getPlugIn() != NULL)
   {
      mpExporterPage = mpExporter->getExportOptionsWidget();
   }

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

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

   // Layout
   QVBoxLayout* pLayout = new QVBoxLayout(this);
   pLayout->setMargin(10);
   pLayout->setSpacing(10);
   pLayout->addWidget(pStack, 10);
   pLayout->addWidget(pLine);
   pLayout->addWidget(pButtonBox);

   // Initialization
   QString strWindowTitle = "Export Options";

   SessionItem* pSessionItem = mpExporter->getItem();
   if (pSessionItem != NULL)
   {
      string name = pSessionItem->getDisplayName();
      if (name.empty() == true)
      {
         name = pSessionItem->getName();
      }

      if (name.empty() == false)
      {
         strWindowTitle += ": " + QString::fromStdString(name);
      }
   }

   setWindowTitle(strWindowTitle);
   setModal(true);

   if ((mpSubsetPage != NULL) || (mpExporterPage != NULL))
   {
      QWidget* pSubsetWidget = NULL;
      if (mpSubsetPage != NULL)
      {
         pSubsetWidget = new QWidget();
         mpSubsetPage->setParent(pSubsetWidget);

         QVBoxLayout* pSubsetLayout = new QVBoxLayout(pSubsetWidget);
         if (mpExporterPage != NULL)
         {
            pSubsetLayout->setMargin(10);
         }
         else
         {
            pSubsetLayout->setMargin(0);
         }

         pSubsetLayout->setSpacing(10);
         pSubsetLayout->addWidget(mpSubsetPage);
      }

      QWidget* pExporterWidget = NULL;
      if (mpExporterPage != NULL)
      {
         pExporterWidget = new QWidget();
         mpExporterPage->setParent(pExporterWidget);

         QVBoxLayout* pExporterLayout = new QVBoxLayout(pExporterWidget);
         if (mpSubsetPage != NULL)
         {
            pExporterLayout->setMargin(10);
         }
         else
         {
            pExporterLayout->setMargin(0);
         }

         pExporterLayout->setSpacing(10);
         pExporterLayout->addWidget(mpExporterPage);
      }

      if ((pSubsetWidget != NULL) && (pExporterWidget != NULL))
      {
         QString strExporterCaption = mpExporterPage->windowTitle();
         if (strExporterCaption.isEmpty() == true)
         {
            PlugIn* pPlugIn = mpExporter->getPlugIn();
            if (pPlugIn != NULL)
            {
               strExporterCaption = QString::fromStdString(pPlugIn->getName());
            }

            if (strExporterCaption.isEmpty() == true)
            {
               strExporterCaption = "Exporter";
            }
         }

         mpTabWidget = new QTabWidget(this);
         mpTabWidget->setTabPosition(QTabWidget::North);
         mpTabWidget->addTab(pSubsetWidget, "Subset");
         mpTabWidget->addTab(pExporterWidget, strExporterCaption);
         pStack->addWidget(mpTabWidget);
      }
      else if (pSubsetWidget != NULL)
      {
         pStack->addWidget(pSubsetWidget);
         pButtonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
      }
      else if (pExporterWidget != NULL)
      {
         pStack->addWidget(pExporterWidget);
      }
   }

   if (pStack->count() == 0)
   {
      QLabel* pNoOptionsLabel = new QLabel("No options are available", this);
      pNoOptionsLabel->setAlignment(Qt::AlignCenter);
      pNoOptionsLabel->setMinimumSize(250, 100);

      pStack->addWidget(pNoOptionsLabel);
   }

   // Connections
   VERIFYNR(connect(pButtonBox, SIGNAL(accepted()), this, SLOT(accept())));
   VERIFYNR(connect(pButtonBox, SIGNAL(rejected()), this, SLOT(reject())));
}
コード例 #24
0
ファイル: actionForm.cpp プロジェクト: uiii/FakeInput
ActionForm::ActionForm(QWidget* parent):
    QWidget(parent)
{
    QVBoxLayout* vbox = new QVBoxLayout(this);

    actionType_ = new QComboBox(this);
    actionType_->addItem("press & release key");
    actionType_->addItem("click mouse button");
    actionType_->addItem("move mouse");
    actionType_->addItem("rotate wheel");
    actionType_->addItem("run command");
    actionType_->addItem("wait");
    
    QWidget* keyOptions_ = new QWidget();
    QWidget* mouseButtonOptions_ = new QWidget();
    QWidget* mouseMotionOptions_ = new QWidget();
    QWidget* mouseWheelOptions_ = new QWidget();
    QWidget* commandOptions_ = new QWidget();
    QWidget* waitOptions_ = new QWidget();

    QHBoxLayout* keyHBox = new QHBoxLayout();
    QHBoxLayout* mouseButtonHBox = new QHBoxLayout();
    QHBoxLayout* mouseMotionHBox = new QHBoxLayout();
    QHBoxLayout* mouseWheelHBox = new QHBoxLayout();
    QHBoxLayout* commandHBox = new QHBoxLayout();
    QHBoxLayout* waitHBox = new QHBoxLayout();

    keySelector_ = new QComboBox();
    keySelector_->addItem("A", QVariant::fromValue<FakeInput::KeyType>(FakeInput::Key_A)); 	
	keySelector_->addItem("B", QVariant::fromValue<FakeInput::KeyType>(FakeInput::Key_B)); 	
	keySelector_->addItem("C", QVariant::fromValue<FakeInput::KeyType>(FakeInput::Key_C)); 	
	keySelector_->addItem("D", QVariant::fromValue<FakeInput::KeyType>(FakeInput::Key_D)); 	
	keySelector_->addItem("E", QVariant::fromValue<FakeInput::KeyType>(FakeInput::Key_E)); 	
	keySelector_->addItem("F", QVariant::fromValue<FakeInput::KeyType>(FakeInput::Key_F)); 	
	keySelector_->addItem("G", QVariant::fromValue<FakeInput::KeyType>(FakeInput::Key_G)); 	
	keySelector_->addItem("H", QVariant::fromValue<FakeInput::KeyType>(FakeInput::Key_H)); 	
	keySelector_->addItem("I", QVariant::fromValue<FakeInput::KeyType>(FakeInput::Key_I)); 	
	keySelector_->addItem("J", QVariant::fromValue<FakeInput::KeyType>(FakeInput::Key_J)); 	
	keySelector_->addItem("K", QVariant::fromValue<FakeInput::KeyType>(FakeInput::Key_K)); 	
	keySelector_->addItem("L", QVariant::fromValue<FakeInput::KeyType>(FakeInput::Key_L)); 	
	keySelector_->addItem("M", QVariant::fromValue<FakeInput::KeyType>(FakeInput::Key_M)); 	
	keySelector_->addItem("N", QVariant::fromValue<FakeInput::KeyType>(FakeInput::Key_N)); 	
	keySelector_->addItem("O", QVariant::fromValue<FakeInput::KeyType>(FakeInput::Key_O)); 	
	keySelector_->addItem("P", QVariant::fromValue<FakeInput::KeyType>(FakeInput::Key_P)); 	
	keySelector_->addItem("Q", QVariant::fromValue<FakeInput::KeyType>(FakeInput::Key_Q));
	keySelector_->addItem("R", QVariant::fromValue<FakeInput::KeyType>(FakeInput::Key_R));
	keySelector_->addItem("S", QVariant::fromValue<FakeInput::KeyType>(FakeInput::Key_S));
	keySelector_->addItem("T", QVariant::fromValue<FakeInput::KeyType>(FakeInput::Key_T));
	keySelector_->addItem("U", QVariant::fromValue<FakeInput::KeyType>(FakeInput::Key_U));
	keySelector_->addItem("V", QVariant::fromValue<FakeInput::KeyType>(FakeInput::Key_V));
	keySelector_->addItem("W", QVariant::fromValue<FakeInput::KeyType>(FakeInput::Key_W));
	keySelector_->addItem("X", QVariant::fromValue<FakeInput::KeyType>(FakeInput::Key_X));
	keySelector_->addItem("Y", QVariant::fromValue<FakeInput::KeyType>(FakeInput::Key_Y));
	keySelector_->addItem("Z", QVariant::fromValue<FakeInput::KeyType>(FakeInput::Key_Z));

    mouseButtonSelector_ = new QComboBox();
    mouseButtonSelector_->addItem("Left", QVariant::fromValue<FakeInput::MouseButton>(FakeInput::Mouse_Left));
	mouseButtonSelector_->addItem("Middle", QVariant::fromValue<FakeInput::MouseButton>(FakeInput::Mouse_Middle));
	mouseButtonSelector_->addItem("Right", QVariant::fromValue<FakeInput::MouseButton>(FakeInput::Mouse_Right));

    QLabel* xLabel = new QLabel("dx: ");
    QLabel* yLabel = new QLabel("dy: ");
    mouseMotionX_ = new QSpinBox();
    mouseMotionX_->setSingleStep(50);
    mouseMotionX_->setMinimum(-10000);
    mouseMotionX_->setMaximum(10000);
    mouseMotionY_ = new QSpinBox();
    mouseMotionY_->setSingleStep(50);
    mouseMotionY_->setMinimum(-10000);
    mouseMotionY_->setMaximum(10000);

    mouseWheelDirection_ = new QComboBox();
    mouseWheelDirection_->addItem("Up");
	mouseWheelDirection_->addItem("Down");

    command_ = new QLineEdit();

    QLabel* timeLabel = new QLabel("miliseconds: ");
    waitTime_ = new QSpinBox();
    waitTime_->setSingleStep(50);
    waitTime_->setMaximum(10000);

    keyHBox->addWidget(keySelector_);
    mouseButtonHBox->addWidget(mouseButtonSelector_);
    mouseMotionHBox->addWidget(xLabel);
    mouseMotionHBox->addWidget(mouseMotionX_);
    mouseMotionHBox->addWidget(yLabel);
    mouseMotionHBox->addWidget(mouseMotionY_);
    mouseWheelHBox->addWidget(mouseWheelDirection_);
    commandHBox->addWidget(command_);
    waitHBox->addWidget(timeLabel);
    waitHBox->addWidget(waitTime_);

    keyOptions_->setLayout(keyHBox);
    mouseButtonOptions_->setLayout(mouseButtonHBox);
    mouseMotionOptions_->setLayout(mouseMotionHBox);
    mouseWheelOptions_->setLayout(mouseWheelHBox);
    commandOptions_->setLayout(commandHBox);
    waitOptions_->setLayout(waitHBox);

    QStackedWidget* stack = new QStackedWidget(this);
    stack->addWidget(keyOptions_);
    stack->addWidget(mouseButtonOptions_);
    stack->addWidget(mouseMotionOptions_);
    stack->addWidget(mouseWheelOptions_);
    stack->addWidget(commandOptions_);
    stack->addWidget(waitOptions_);

    vbox->addWidget(actionType_);
    vbox->addWidget(stack);
    vbox->addStretch(1);

    setLayout(vbox);

    connect(actionType_, SIGNAL(currentIndexChanged(int)), stack, SLOT(setCurrentIndex(int)));
}
コード例 #25
0
CleanupSettings::CleanupSettings(QWidget *parent)
	: QWidget(parent), m_attached(false)
{
	QVBoxLayout *vLayout = new QVBoxLayout(this);
	vLayout->setMargin(1); // NOTE: This works to show the 1-pix black border,
						   // because this is a QWidget (not QFrame) heir...
	setLayout(vLayout);

	//   Tabs Container
	// Used to deal with styled background and other stuff

	TabBarContainter *tabBarContainer = new TabBarContainter(this);
	QHBoxLayout *hLayout = new QHBoxLayout(tabBarContainer);

	hLayout->setMargin(0);
	hLayout->setAlignment(Qt::AlignLeft);
	hLayout->addSpacing(6);

	vLayout->addWidget(tabBarContainer);

	//  Tabs Bar

	DVGui::TabBar *tabBar = new DVGui::TabBar(this);
	hLayout->addWidget(tabBar);

	tabBar->addSimpleTab(tr("Cleanup"));
	tabBar->addSimpleTab(tr("Processing"));
	tabBar->addSimpleTab(tr("Camera"));
	tabBar->setDrawBase(false);

	//  Splitter

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

	//  Stacked Widget

	QStackedWidget *stackedWidget = new QStackedWidget(split);
	stackedWidget->setMinimumWidth(300);
	//stackedWidget->setMinimumHeight(250);

	split->addWidget(stackedWidget);
	split->setStretchFactor(0, 1);

	//  Cleanup Tab

	QScrollArea *scrollArea = new QScrollArea(stackedWidget);
	stackedWidget->addWidget(scrollArea);

	scrollArea->setWidgetResizable(true);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

	m_cleanupTab = new CleanupTab;
	scrollArea->setWidget(m_cleanupTab);

	//  Processing Tab

	scrollArea = new QScrollArea(stackedWidget);
	stackedWidget->addWidget(scrollArea);

	scrollArea->setWidgetResizable(true);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

	m_processingTab = new ProcessingTab;
	scrollArea->setWidget(m_processingTab);

	//  Camera Tab

	scrollArea = new QScrollArea(stackedWidget);
	stackedWidget->addWidget(scrollArea);

	scrollArea->setWidgetResizable(true);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

	m_cameraTab = new CameraTab;
	scrollArea->setWidget(m_cameraTab);

	m_cameraTab->setCameraPresetListFile(ToonzFolder::getReslistPath(true));

	//  Swatch

	m_swatch = new CleanupSwatch(split, 200, 150);
	split->addWidget(m_swatch);

	//  ToolBar

	QWidget *toolBarWidget = new QWidget(this);
	vLayout->addWidget(toolBarWidget);

	toolBarWidget->setFixedHeight(22);

	QHBoxLayout *toolBarLayout = new QHBoxLayout(toolBarWidget);
	toolBarWidget->setLayout(toolBarLayout);

	toolBarLayout->setMargin(0);
	toolBarLayout->setSpacing(0);

	QToolBar *leftToolBar = new QToolBar(toolBarWidget);
	toolBarLayout->addWidget(leftToolBar, 0, Qt::AlignLeft);

	leftToolBar->setFixedWidth(110);

	m_swatchAct = new QAction(createQIconOnOffPNG("preview", true), tr("Toggle Swatch Preview"), this);
	m_swatchAct->setCheckable(true);
	leftToolBar->addAction(m_swatchAct);
	leftToolBar->addSeparator();

	m_opacityAct = new QAction(createQIconOnOffPNG("opacitycheck", true), tr("Toggle Opacity Check"), this);
	m_opacityAct->setCheckable(true);
	leftToolBar->addAction(m_opacityAct);

	QToolBar *spacingToolBar1 = new QToolBar(toolBarWidget);
	toolBarLayout->addWidget(spacingToolBar1, 1);

	spacingToolBar1->setMinimumHeight(22);

	QToolBar *rightToolBar = new QToolBar(toolBarWidget);
	toolBarLayout->addWidget(rightToolBar, 0, Qt::AlignRight);

	rightToolBar->setFixedWidth(110);

	QAction *saveAct = new QAction(createQIconOnOffPNG("save", false), tr("Save Settings"), this);
	rightToolBar->addAction(saveAct);
	QAction *loadAct = new QAction(createQIconOnOffPNG("load", false), tr("Load Settings"), this);
	rightToolBar->addAction(loadAct);
	rightToolBar->addSeparator();
	QAction *resetAct = new QAction(createQIconOnOffPNG("resetsize", false), tr("Reset Settings"), this);
	rightToolBar->addAction(resetAct);

	//  Model-related stuff
	CleanupSettingsModel *model = CleanupSettingsModel::instance();
	m_backupParams.assign(model->getCurrentParameters(), false);

	//  Connections

	QAction *opacityCheckCmd = CommandManager::instance()->getAction(MI_OpacityCheck);
	assert(opacityCheckCmd);

	bool ret = true;
	ret = ret && connect(tabBar, SIGNAL(currentChanged(int)), stackedWidget, SLOT(setCurrentIndex(int)));
	ret = ret && connect(m_swatchAct, SIGNAL(toggled(bool)), SLOT(enableSwatch(bool)));
	ret = ret && connect(m_opacityAct, SIGNAL(triggered(bool)), opacityCheckCmd, SLOT(trigger()));
	ret = ret && connect(saveAct, SIGNAL(triggered()), model, SLOT(promptSave()));
	ret = ret && connect(loadAct, SIGNAL(triggered()), model, SLOT(promptLoad()));
	ret = ret && connect(resetAct, SIGNAL(triggered()), this, SLOT(onRestoreSceneSettings()));

	assert(ret);
}
コード例 #26
0
QWidget *ConfigDialog::centerWidget()
{
/*
	m_pagesTabWidget = new QTabWidget;
	for (int i = 0; i < m_pageWidgets.size(); ++i)
		m_pagesTabWidget->addTab(m_pageWidgets.at(i), m_pageTitles.at(i));
	return m_pagesTabWidget;
*/
	// create list
	QListWidget *pagesListWidget = new QListWidget;
	pagesListWidget->setViewMode(QListView::IconMode);
	pagesListWidget->setMovement(QListView::Static);
	pagesListWidget->setFlow(QListView::TopToBottom);
	pagesListWidget->setWordWrap(true);
	pagesListWidget->setUniformItemSizes(true);
	pagesListWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);

	// add items to list
	QFontMetrics fm(qApp->font());
	int iconWidth = 0;
	for (int i = 0; i < m_pagesListWidgetItems.size(); ++i)
		iconWidth = qMax(iconWidth, fm.boundingRect(0, 0, 0, 0, Qt::AlignCenter, m_pagesListWidgetItems.at(i)->text()).width());
	iconWidth += 20;
	const int iconHeight = fm.height() + 42;
	for (int i = 0; i < m_pagesListWidgetItems.size(); ++i)
	{
		m_pagesListWidgetItems.at(i)->setSizeHint(QSize(iconWidth, iconHeight));
		pagesListWidget->addItem(m_pagesListWidgetItems.at(i));
	}
	pagesListWidget->setFixedWidth(m_pagesListWidgetItems.at(0)->sizeHint().width() + 6);

	// create title
	QFrame *titleFrame = new QFrame(this);
//	titleFrame->setAutoFillBackground(true);
//	titleFrame->setFrameShape(QFrame::StyledPanel);
	titleFrame->setFrameShape(QFrame::Box);
//	titleFrame->setFrameShadow(QFrame::Plain);
//	titleFrame->setBackgroundRole(QPalette::Base);
	m_pagesTitleLabel = new QLabel(titleFrame);
	m_pagesTitleLabel->setStyleSheet("QLabel { font-weight: bold; }");
	QGridLayout *titleLayout = new QGridLayout(titleFrame);
	titleLayout->setColumnStretch(0, 1);
	titleLayout->setMargin(6);
	titleLayout->addWidget(m_pagesTitleLabel);

	// add pages
	QStackedWidget *pagesStackedWidget = new QStackedWidget;
	for (int i = 0; i < m_pageWidgets.size(); ++i)
		pagesStackedWidget->addWidget(m_pageWidgets.at(i));
	connect(pagesListWidget, SIGNAL(currentRowChanged(int)), pagesStackedWidget, SLOT(setCurrentIndex(int)));
	connect(pagesListWidget, SIGNAL(currentRowChanged(int)), this, SLOT(setCurrentPage(int)));
	pagesListWidget->setCurrentRow(0);

	QWidget *mainWidget = new QWidget;
	QGridLayout *mainLayout = new QGridLayout;
	mainLayout->addWidget(pagesListWidget, 0, 0, 2, 1);
	mainLayout->addWidget(titleFrame, 0, 1);
	mainLayout->addWidget(pagesStackedWidget, 1, 1);
	mainWidget->setLayout(mainLayout);

	return mainWidget;
}
コード例 #27
0
ファイル: main.cpp プロジェクト: tynn/H4KvT
int main(int argc, char **argv)
{
	Vals vals;

	/* the application */
	QApplication app(argc, argv);
	app.setApplicationName(APP_NAME);
	app.setWindowIcon(QIcon(":/icon"));
	Window window;

	/* translations */
	QTranslator qtr;
	if (qtr.load("qt_" + QLocale::system().name(), QTR_PATH))
		app.installTranslator(&qtr);

	QTranslator htr;
	if (htr.load("H4KvT_" + QLocale::system().name(), ":/"))
		app.installTranslator(&htr);

	/* display information */
	QTextEdit *text = new QTextEdit;
	text->setReadOnly(true);
	text->setLineWrapMode(QTextEdit::NoWrap);
	text->setToolTip(Window::tr("Drop any file for hashing"));
	QObject::connect(&window, &Window::idle, text, &QWidget::setEnabled);

	/* compare hash */
	QLineEdit *test = new QLineEdit;
	HexVal hexval;
	test->setValidator(&hexval);
	test->installEventFilter(&window);
	test->setToolTip(Window::tr("Compare hashes"));

	QObject::connect(test, &QLineEdit::textChanged,
		[&](const QString &newValue) { if (vals.name != "") {
			std::string hashVal = newValue.toStdString();
			std::transform(hashVal.begin(), hashVal.end(), hashVal.begin(), ::tolower);
			std::stringstream html;
			if (hashVal != "")
				html << "<style>.h" << hashVal << "{color:green}</style>";
			html << "<div style='margin-bottom:2; font-size:27px'><i><b>" << vals.name << "</b></i></div>";
			html << "<div style='margin-bottom:7; margin-left:23; font-size:13px'>" << vals.path << "</div>";
			if (!ALL(vals,"")) {
				html << "<div style='font-size:13px'><table>";
				if (vals.md5 != "")
					html << "<tr><td>md5: </td><td class='h" << vals.md5 << "'>" << vals.md5 << "</td</tr>";
				if (vals.sha1 != "")
					html << "<tr><td>sha1: </td><td class='h" << vals.sha1 << "'>" << vals.sha1 << "</td</tr>";
				if (vals.sha224 != "")
					html << "<tr><td>sha224: </td><td class='h" << vals.sha224 << "'>" << vals.sha224 << "</td</tr>";
				if (vals.sha256 != "")
					html << "<tr><td>sha256: </td><td class='h" << vals.sha256 << "'>" << vals.sha256 << "</td</tr>";
				if (vals.sha384 != "")
					html << "<tr><td>sha384: </td><td class='h" << vals.sha384 << "'>" << vals.sha384 << "</td</tr>";
				if (vals.sha512 != "")
					html << "<tr><td>sha512: </td><td class='h" << vals.sha512 << "'>" << vals.sha512 << "</td</tr>";
				html << "</table></div>";
			}
			int horizontal = text->horizontalScrollBar()->value();
			int vertical = text->verticalScrollBar()->value();
			text->setHtml(QString::fromStdString(html.str()));
			text->horizontalScrollBar()->setValue(horizontal);
			text->verticalScrollBar()->setValue(vertical);
			test->setStyleSheet(ANY(vals,hashVal) ? "color:green" : "");
		}});

	/* error messages */
	QLabel *error = new QLabel;
	error->setStyleSheet("color:red");

	/* test or error */
	QStackedWidget *stack = new QStackedWidget;
	delete stack->layout();
	stack->setLayout(new Stack);
	stack->addWidget(error);
	stack->addWidget(test);
	stack->setCurrentIndex(1);

	/* toggle test or error */
	QPushButton *hash = new QPushButton(QIcon(":/icon"), "");
	hash->setCheckable(true);
	hash->setChecked(true);
	hash->setToolTip(Window::tr("Compare hashes"));
	QObject::connect(hash, &QPushButton::toggled, stack, &QStackedWidget::setCurrentIndex);

	/* store method */
	QSettings settings("H4KvT", "H4KvT");

	/* more methods */
	bool more;
	try {
		settings.setValue("MoreHashingMethods", more = moreOrLess());
	} catch (...) {
		more = settings.value("MoreHashingMethods", false).toBool();
	}

	/* hashing method */
	QComboBox *meth = new QComboBox;
	meth->addItem("md5");
	meth->addItem("sha1");
	if (more) meth->addItem("sha224");
	meth->addItem("sha256");
	if (more) meth->addItem("sha384");
	meth->addItem("sha512");
	meth->setToolTip(Window::tr("Hashing method"));
	meth->setCurrentText(settings.value("HashingMethod", "md5").toString());
	QObject::connect(&window, &Window::idle, meth, &QWidget::setEnabled);

	QObject::connect(meth, &QComboBox::currentTextChanged,
		[&](const QString &text) { settings.setValue("HashingMethod", text); });

	/* toolbar */
	QHBoxLayout *pane = new QHBoxLayout;
	pane->addWidget(hash, 0, Qt::AlignLeft);
	pane->addWidget(stack);
	pane->addWidget(meth, 0, Qt::AlignRight);

	/* main layout */
	QVBoxLayout *layout = new QVBoxLayout;
	layout->addWidget(text);
	layout->addLayout(pane);

	/* the window */
	window.centralWidget()->setLayout(layout);
	window.show();

	/* future hashing */
	QFutureWatcher<Vals> zu;
	QObject::connect(&zu, &QFutureWatcher<Vals>::finished,
		[&]() {
			Vals valsi = zu.future().result();
			window.idle(true);
			if (valsi.path == "") {
				error->setText(QString::fromStdString(valsi.name));
				hash->setChecked(false);
			} else {
				error->clear();
				vals += valsi;
				test->textChanged(test->text());
			}
		});

	QObject::connect(meth, &QComboBox::currentTextChanged,
		[&](const QString &text) { if (vals.name != "") {
			window.idle(false);
			zu.setFuture(QtConcurrent::run(&update, text, vals));
		}});

	QObject::connect(&window, &Window::fileDroped,
		[&](const QString &name, const QString &path) {
			window.idle(false);
			zu.setFuture(QtConcurrent::run(&update, meth->currentText(), Vals(name, path)));
		});

	/* hashing info */
	QGraphicsBlurEffect blur;
	blur.setBlurHints(QGraphicsBlurEffect::AnimationHint);

	QPropertyAnimation anim(&blur, "blurRadius");
	anim.setDuration(2000);
	anim.setLoopCount(-1);
	anim.setKeyValueAt(0, 0);
	anim.setKeyValueAt(0.5, 3);
	anim.setKeyValueAt(1, 0);

	QLabel *hashing = new QLabel;
	hashing->setPixmap(QPixmap(":/icon"));
	hashing->setAttribute(Qt::WA_TransparentForMouseEvents);
	hashing->setGraphicsEffect(&blur);
	hashing->hide();
	(new QHBoxLayout(text))->addWidget(hashing, 0, Qt::AlignCenter);

	QObject::connect(&blur, &QGraphicsBlurEffect::blurRadiusChanged,
		hashing, static_cast<void(QWidget::*)()>(&QWidget::update));

	QObject::connect(&window, &Window::idle,
		[&](bool idle) {
			if (idle) {
				hashing->hide();
				anim.stop();
			} else {
				hashing->show();
				anim.start();
			}
		});

	/* about app */
	QMenu about;
	QAction *action = about.addAction(QIcon(":/icon"), Window::tr("About %1").arg(APP_NAME));
	action->setMenuRole(QAction::AboutRole);
	QObject::connect(action, &QAction::triggered, &window, &Window::about);

	error->setContextMenuPolicy(Qt::NoContextMenu);
	hash->setContextMenuPolicy(Qt::NoContextMenu);
	meth->setContextMenuPolicy(Qt::NoContextMenu);
	window.setContextMenuPolicy(Qt::CustomContextMenu);
	QObject::connect(&window, &QWidget::customContextMenuRequested,
		[&about, &window](const QPoint &pos) { about.popup(window.mapToGlobal(pos)); });

	text->setContextMenuPolicy(Qt::CustomContextMenu);
	QObject::connect(text, &QWidget::customContextMenuRequested,
		[action, text](const QPoint &pos) {
			if (QMenu *m = text->createStandardContextMenu()) {
				m->insertAction(m->insertSeparator(m->actions()[0]), action);
				m->popup(text->mapToGlobal(pos));
			}
		});

	test->setContextMenuPolicy(Qt::CustomContextMenu);
	QObject::connect(test, &QWidget::customContextMenuRequested,
		[action, test](const QPoint &pos) {
			if (QMenu *m = test->createStandardContextMenu()) {
				m->insertAction(m->insertSeparator(m->actions()[0]), action);
				m->popup(test->mapToGlobal(pos));
			}
		});

	return app.exec();
}
コード例 #28
0
void
msg_list_window::add_msgs_page(const msgs_filter* f, bool if_results _UNUSED_)
{
  m_filter = new msgs_filter(*f);
  QFont body_font;
  QFont list_font;
  QByteArray headerview_setup;

  msgs_page* current = m_pages->current_page();
  // current may be null if we're instantiating the first page
  if (current) {
    body_font = m_msgview->font();
    list_font = m_qlist->font();
    if (m_qlist->sender_recipient_swapped())
      m_qlist->swap_sender_recipient(false);    
    headerview_setup = m_qlist->header()->saveState();
  }

  // new splitter
  QStackedWidget* stackw = m_pages->stacked_widget();
  QSplitter* l=new QSplitter(Qt::Vertical, this);
  stackw->addWidget(l);

  m_qlist = new mail_listview(l);
  m_qlist->set_threaded(display_vars.m_threaded);
  m_qlist->m_msg_window=this;
  if (current)
    m_qlist->setFont(list_font);
  m_qlist->init_columns();
  if (current)
    m_qlist->header()->restoreState(headerview_setup);

  if (!m_filter->m_fetched)
    m_filter->fetch(m_qlist);
  else
    m_filter->make_list(m_qlist);
  msg_list_postprocess();

  m_msgview = new message_view(l, this);

  if (current)
    m_msgview->setFont(body_font);

  connect(m_msgview, SIGNAL(on_demand_show_request()), this, SLOT(display_msg_contents()));
  connect(m_msgview, SIGNAL(popup_body_context_menu()), this, SLOT(body_menu()));
  connect(m_msgview, SIGNAL(page_back()), this, SLOT(move_backward()));
  connect(m_msgview, SIGNAL(page_forward()), this, SLOT(move_forward()));

  m_qAttch = new attch_listview(l);
  connect(m_qAttch, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
	  this, SLOT(attch_selected(QTreeWidgetItem*,int)));
  connect(m_qAttch, SIGNAL(init_progress(const QString)),
	  this, SLOT(install_progressbar(const QString)));
  connect(m_qAttch, SIGNAL(progress(int)), this, SLOT(show_progress(int)));
  connect(m_qAttch, SIGNAL(finish_progress()), this, SLOT(uninstall_progressbar()));
  connect(this, SIGNAL(abort_progress()), m_qAttch, SLOT(download_aborted()));

  // splitter for 3 panes: list of messages / body / attachments list
  static const int splitter_default_sizes[3] = {100,400,25};
  QList<int> lsizes;
  if (current) {
    lsizes = current->m_page_splitter->sizes();
    // don't allow any zero size for panels. This is necessary to avoid having the
    // attachment list being almost invisible to the user
    for (int i=0; i<3; i++) {
      if (lsizes.at(i)==0) {
	lsizes.replace(i, splitter_default_sizes[i]);
      }
    }
  }
  else {
    for (int i=0; i<3; i++) {
      int sz;
      QString key;
      key.sprintf("display/msglist/panel%d_size", i+1);
      if (get_config().exists(key)) {
	sz=get_config().get_number(key);
	if (sz==0)
	  sz=splitter_default_sizes[i];
      }
      else
	sz=splitter_default_sizes[i];
      lsizes.append(sz);
    }
  }

  /* avoid changing the listview's height each time the attachments view
     is shown or hidden */
  l->setStretchFactor(l->indexOf(m_qlist), 0);
  l->setStretchFactor(l->indexOf(m_msgview), 1);
  l->setStretchFactor(l->indexOf(m_qAttch), 0);

  l->setSizes(lsizes);
  m_qAttch->hide();
  m_wSearch=NULL;

  connect(m_qlist,SIGNAL(selection_changed()), this,SLOT(mails_selected()));

  connect(m_qlist,SIGNAL(doubleClicked(const QModelIndex&)),
	  this,SLOT(mail_reply_all()));

  connect(m_qlist, SIGNAL(clicked(const QModelIndex&)),
	  this, SLOT(action_click_msg_list(const QModelIndex&)));

  connect(m_qlist, SIGNAL(scroll_page_down()), m_msgview, SLOT(page_down()));

  if (m_pages->next_page()) {
    // we're in the middle of a page list, and asked to go forward.
    // let's remove all the pages that are after the current position
    m_pages->cut_pages(m_pages->next_page());
  }
  int max_pages=get_config().get_number("msg_window_pages");
  if (max_pages<2) max_pages=2;
  if (m_pages->count() >= max_pages) {
    free_msgs_page();
    if (m_pages->count() >= max_pages) {
      // Still no room for a new page? OK, forget it
      DBG_PRINTF(5,"not enough pages!");
      return;
    }
  }

  // allocate and use a new page
  msgs_page* page = new msgs_page();
  page->m_page_filter = m_filter;
  page->m_page_msgview = m_msgview;
  page->m_page_attach = m_qAttch;
  page->m_page_qlist = m_qlist;
  page->m_page_current_item = NULL;
  page->m_page_splitter = l;
  page->m_msgs_window = this;
  page->m_query_lvitem_id = m_query_lv->current_id();
  m_pages->add_page(page);
  m_pages->raise_page(page);
  m_tags_box->reset_tags();
  enable_forward_backward();
}
//FIXME: keep loaded plugins in own plugin manager and
//unload plugins to let load new version without
//the need to restart the application
void RackWindow::loadPlugin(QWidget *pluginHost)
{
    QDir pluginsDir(qApp->applicationDirPath());
#if defined(Q_OS_WIN)
    if (pluginsDir.dirName().toLower() == "debug" || pluginsDir.dirName().toLower() == "release")
        pluginsDir.cdUp();
#elif defined(Q_OS_MAC)
    if (pluginsDir.dirName() == "MacOS") {
        pluginsDir.cdUp();
        pluginsDir.cdUp();
        pluginsDir.cdUp();
    }
#endif

    if (!pluginsDir.cd("plugins"))
    {
        QMessageBox::information(this, "Error", "No plugin folder found");
        return;
    }


    QStringList pluginList = pluginsDir.entryList(QDir::Files);


    RSelectPluginDialog pluginDialog(this);
    pluginDialog.pluginListWidget->addItems(pluginList);
    pluginDialog.pluginListWidget->setCurrentRow(0);
    if (pluginDialog.exec())
    {



//    bool ok;
//    int newPluginIndex = RSelectPluginDialog::getIndex(this, pluginList, &ok);
//    if (ok) {

        //QString fileName = pluginsDir.entryList(QDir::Files).at(newPluginIndex);

        QString fileName = pluginsDir.entryList(QDir::Files).at(pluginDialog.pluginListWidget->currentRow());

        QPluginLoader pluginLoader(pluginsDir.absoluteFilePath(fileName));
        QObject *plugin = pluginLoader.instance();


        ///test

//        QList<QPluginLoader *> loadedPlugins = findChildren<QPluginLoader *>();

//        QObject *plugin = 0;

//        for (int i = 0; i < loadedPlugins.size(); ++i) {
//            if (loadedPlugins.at(i)->fileName() == pluginsDir.absoluteFilePath(fileName)) {
//                plugin = loadedPlugins.at(i)->instance();
//                break;
//            }
//        }

//        if (!plugin) {
//            QPluginLoader *pluginLoader = new QPluginLoader(pluginsDir.absoluteFilePath(fileName), this);
//            plugin = pluginLoader->instance();
//        }


        //debug code
        qDebug() << "we have the following plugins loaded:";
        QList<QPluginLoader *> debugPlugins = findChildren<QPluginLoader *>();
        for (int i = 0; i < debugPlugins.size(); ++i) {
            qDebug() << debugPlugins.at(i)->fileName();
        }


        //////////


//        m_pluginLoader = new QPluginLoader(pluginsDir.absoluteFilePath(fileName), this);
//        QObject *plugin = m_pluginLoader->instance();

        /////////////////


        if (plugin)
        {
            IWidgetPlugin *widgetPlugin = qobject_cast<IWidgetPlugin *>(plugin);
            if (widgetPlugin)
            {
                QWidget *newWidget = widgetPlugin->createRWidget(m_coreImpl, this);

                //get pointers from pluginhost:
                QStackedWidget *pluginStack = pluginHost->findChild<QStackedWidget *>("rackPluginStack");
                QToolBar *pluginHostToolBar = pluginHost->findChild<QToolBar *>("rackPluginHostToolBar");
                QToolBar *pluginToolBar = pluginHost->property("pluginToolBar").value<QToolBar *>();
                QSignalMapper *sm = pluginHost->findChild<QSignalMapper *>("rackPluginSwitchMapper");
                QActionGroup *ag = pluginHostToolBar->findChild<QActionGroup *>();

                //add plugin widget to the widget stack:
                pluginStack->setCurrentIndex(pluginStack->addWidget(newWidget));

                //create action for the toolbars:
                QAction *act = new QAction(widgetPlugin->name(), ag);
                act->setCheckable(true);
                act->setChecked(true);
                //qt bugfix: set transparent dummy icon to move button text down or right
                act->setIcon(QIcon(":/images/transparent-icon.png"));

                //create button for pluginhost toolbar:
                QToolButton *tb = new QToolButton;
                tb->setObjectName(QLatin1String(newWidget->metaObject()->className()) + "ToolButton");
                tb->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
                tb->setFocusPolicy(Qt::NoFocus);
                tb->setDefaultAction(act);
                RPushButton *settingsButton = new RPushButton;
                settingsButton->setObjectName("rackPluginHostToolBarSettingsButton");
                RPushButton *deleteButton = new RPushButton;
                deleteButton->setObjectName("rackPluginHostToolBarDeleteButton");
                QHBoxLayout *hl = new QHBoxLayout(tb);
                hl->setSpacing(0);
                hl->setContentsMargins(0,0,1,0);
                hl->addStretch();
                hl->addWidget(settingsButton);
                hl->addWidget(deleteButton);
                pluginHostToolBar->addWidget(tb);

                //create button for plugin toolbar:
                QToolButton *tb1 = new QToolButton;
                tb1->setObjectName(QLatin1String(newWidget->metaObject()->className()) + "ToolButton");
                tb1->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
                tb1->setFocusPolicy(Qt::NoFocus);
                tb1->setDefaultAction(act);
                pluginToolBar->addWidget(tb1);

                //connect action trigger to PluginSwitchMapper;
                QObject::connect(act, SIGNAL(triggered()), sm, SLOT(map()));
                sm->setMapping(act, newWidget);

                //connect delete signal
                //remove act from actiongroup and delete it:
                QObject::connect(deleteButton, SIGNAL(clicked()), m_mapperClosePlugin, SLOT(map()));
                m_mapperClosePlugin->setMapping(deleteButton, act);
                QObject::connect(deleteButton, SIGNAL(clicked()), newWidget, SLOT(deleteLater()));
                QObject::connect(deleteButton, SIGNAL(clicked()), tb1, SLOT(deleteLater()));
                QObject::connect(deleteButton, SIGNAL(clicked()), tb, SLOT(deleteLater()));

                //connect settings signal
                //if (plugin has settings) ...
                //QObject::connect(settingsButton, SIGNAL(clicked()),

            }
        }
        else
        {
            QMessageBox::information(this, "Error", "Could not load the plugin");
            qDebug() << pluginLoader.errorString();

        }
    }
}
コード例 #30
0
PropertiesRasterLayer::PropertiesRasterLayer() :
   LabeledSectionGroup(NULL),
   mInitializing(false),
   mpRasterLayer(NULL)
{
   // Display configuration
   QWidget* pDisplayWidget = new QWidget(this);

   QLabel* pDisplayModeLabel = new QLabel("Display Mode:", pDisplayWidget);
   mpDisplayModeCombo = new QComboBox(pDisplayWidget);
   vector<string> modes = StringUtilities::getAllEnumValuesAsDisplayString<DisplayMode>();
   for (vector<string>::iterator it = modes.begin(); it != modes.end(); ++it)
   {
      mpDisplayModeCombo->addItem(QString::fromStdString(*it));
   }
   mpComplexComponentLabel = new QLabel("Complex Component:", pDisplayWidget);
   mpComplexComponentCombo = new ComplexComponentComboBox(pDisplayWidget);
   QLabel* pOpacityLabel = new QLabel("Opacity:", pDisplayWidget);
   mpOpacitySpin = new QSpinBox(pDisplayWidget);
   mpOpacitySpin->setMinimum(0);
   mpOpacitySpin->setMaximum(255);
   mpOpacitySpin->setSingleStep(1);

   LabeledSection* pDisplaySection = new LabeledSection(pDisplayWidget, "Display Configuration", this);

   QGridLayout* pDisplayGrid = new QGridLayout(pDisplayWidget);
   pDisplayGrid->setMargin(0);
   pDisplayGrid->setSpacing(5);
   pDisplayGrid->addWidget(pDisplayModeLabel, 0, 0);
   pDisplayGrid->addWidget(mpDisplayModeCombo, 0, 1, Qt::AlignLeft);
   pDisplayGrid->addWidget(mpComplexComponentLabel, 1, 0);
   pDisplayGrid->addWidget(mpComplexComponentCombo, 1, 1, Qt::AlignLeft);
   pDisplayGrid->addWidget(pOpacityLabel, 2, 0);
   pDisplayGrid->addWidget(mpOpacitySpin, 2, 1, Qt::AlignLeft);
   pDisplayGrid->setRowStretch(3, 10);
   pDisplayGrid->setColumnStretch(1, 10);

   // Grayscale
   QWidget* pGrayscaleWidget = new QWidget(this);

   QLabel* pGrayElementLabel = new QLabel("Display Element:", pGrayscaleWidget);
   mpGrayElementCombo = new QComboBox(pGrayscaleWidget);
   mpGrayElementCombo->setMinimumContentsLength(10);

   QLabel* pGrayBandLabel = new QLabel("Display Band:", pGrayscaleWidget);
   mpGrayBandCombo = new QComboBox(pGrayscaleWidget);

   QLabel* pGrayLowerLabel = new QLabel("Lower Stretch Value:", pGrayscaleWidget);
   mpGrayLowerSpin = new QDoubleSpinBox(pGrayscaleWidget);
   mpGrayLowerSpin->setRange(-1 * numeric_limits<double>::max(), numeric_limits<double>::max());
   mpGrayLowerSpin->setDecimals(6);

   QLabel* pGrayUpperLabel = new QLabel("Upper Stretch Value:", pGrayscaleWidget);
   mpGrayUpperSpin = new QDoubleSpinBox(pGrayscaleWidget);
   mpGrayUpperSpin->setRange(-1 * numeric_limits<double>::max(), numeric_limits<double>::max());
   mpGrayUpperSpin->setDecimals(6);

   QLabel* pGrayUnitsLabel = new QLabel("Stretch Units:", pGrayscaleWidget);
   mpGrayUnitsCombo = new RegionUnitsComboBox(pGrayscaleWidget);

   QLabel* pGrayStretchTypeLabel = new QLabel("Stretch Type:", pGrayscaleWidget);
   mpGrayStretchTypeCombo = new StretchTypeComboBox(pGrayscaleWidget);

   QPushButton* pGrayStretchFavoritesButton = new QPushButton("Favorites", this);
   mpGrayStretchMenu = new QMenu(pGrayStretchFavoritesButton);
   pGrayStretchFavoritesButton->setMenu(mpGrayStretchMenu);

   mpAddFavoriteGrayAction = new QAction("Add Stretch to Favorites", this);
   mpRemoveFavoriteAction = new QAction("Remove Stretch from Favorites...", this);

   LabeledSection* pGrayscaleSection = new LabeledSection(pGrayscaleWidget, "Grayscale", this);

   QGridLayout* pGrayscaleGrid = new QGridLayout(pGrayscaleWidget);
   pGrayscaleGrid->setMargin(0);
   pGrayscaleGrid->setSpacing(5);
   pGrayscaleGrid->addWidget(pGrayElementLabel, 0, 0);
   pGrayscaleGrid->addWidget(mpGrayElementCombo, 0, 1, 1, 2);
   pGrayscaleGrid->addWidget(pGrayBandLabel, 1, 0);
   pGrayscaleGrid->addWidget(mpGrayBandCombo, 1, 1, 1, 2);
   pGrayscaleGrid->addWidget(pGrayLowerLabel, 2, 0);
   pGrayscaleGrid->addWidget(mpGrayLowerSpin, 2, 1);
   pGrayscaleGrid->addWidget(pGrayStretchFavoritesButton, 2, 2, Qt::AlignLeft);
   pGrayscaleGrid->addWidget(pGrayUpperLabel, 3, 0);
   pGrayscaleGrid->addWidget(mpGrayUpperSpin, 3, 1);
   pGrayscaleGrid->addWidget(pGrayUnitsLabel, 4, 0);
   pGrayscaleGrid->addWidget(mpGrayUnitsCombo, 4, 1);
   pGrayscaleGrid->addWidget(pGrayStretchTypeLabel, 5, 0);
   pGrayscaleGrid->addWidget(mpGrayStretchTypeCombo, 5, 1);
   pGrayscaleGrid->setRowStretch(6, 10);
   pGrayscaleGrid->setColumnStretch(2, 10);

   // RGB
   QWidget* pRgbWidget = new QWidget(this);

   QLabel* pRedLabel = new QLabel("Red:", pRgbWidget);
   QLabel* pGreenLabel = new QLabel("Green:", pRgbWidget);
   QLabel* pBlueLabel = new QLabel("Blue:", pRgbWidget);

   QLabel* pRgbElementLabel = new QLabel("Display Element:", pRgbWidget);
   mpRedElementCombo = new QComboBox(pRgbWidget);
   mpRedElementCombo->setMinimumContentsLength(10);
   mpGreenElementCombo = new QComboBox(pRgbWidget);
   mpGreenElementCombo->setMinimumContentsLength(10);
   mpBlueElementCombo = new QComboBox(pRgbWidget);
   mpBlueElementCombo->setMinimumContentsLength(10);

   QLabel* pRgbBandLabel = new QLabel("Display Band:", pRgbWidget);
   mpRedBandCombo = new QComboBox(pRgbWidget);
   mpGreenBandCombo = new QComboBox(pRgbWidget);
   mpBlueBandCombo = new QComboBox(pRgbWidget);

   QLabel* pRgbLowerLabel = new QLabel("Lower Stretch Value:", pRgbWidget);
   mpRedLowerSpin = new QDoubleSpinBox(pRgbWidget);
   mpRedLowerSpin->setRange(-1 * numeric_limits<double>::max(), numeric_limits<double>::max());
   mpRedLowerSpin->setDecimals(6);
   mpGreenLowerSpin = new QDoubleSpinBox(pRgbWidget);
   mpGreenLowerSpin->setRange(-1 * numeric_limits<double>::max(), numeric_limits<double>::max());
   mpGreenLowerSpin->setDecimals(6);
   mpBlueLowerSpin = new QDoubleSpinBox(pRgbWidget);
   mpBlueLowerSpin->setRange(-1 * numeric_limits<double>::max(), numeric_limits<double>::max());
   mpBlueLowerSpin->setDecimals(6);

   QLabel* pRgbUpperLabel = new QLabel("Upper Stretch Value:", pRgbWidget);
   mpRedUpperSpin = new QDoubleSpinBox(pRgbWidget);
   mpRedUpperSpin->setRange(-1 * numeric_limits<double>::max(), numeric_limits<double>::max());
   mpRedUpperSpin->setDecimals(6);
   mpGreenUpperSpin = new QDoubleSpinBox(pRgbWidget);
   mpGreenUpperSpin->setRange(-1 * numeric_limits<double>::max(), numeric_limits<double>::max());
   mpGreenUpperSpin->setDecimals(6);
   mpBlueUpperSpin = new QDoubleSpinBox(pRgbWidget);
   mpBlueUpperSpin->setRange(-1 * numeric_limits<double>::max(), numeric_limits<double>::max());
   mpBlueUpperSpin->setDecimals(6);

   QLabel* pRgbUnitsLabel = new QLabel("Stretch Units:", pRgbWidget);
   mpRedUnitsCombo = new RegionUnitsComboBox(pRgbWidget);
   mpGreenUnitsCombo = new RegionUnitsComboBox(pRgbWidget);
   mpBlueUnitsCombo = new RegionUnitsComboBox(pRgbWidget);

   mpDisplayBandButton = new QPushButton("Presets", pRgbWidget);
   mpDisplayBandButton->setEnabled(false);
   QMenu* pMenu = new QMenu(mpDisplayBandButton);
   mpDisplayBandButton->setMenu(pMenu);

   const DynamicObject* pColorComposites = RasterLayer::getSettingColorComposites();
   if (pColorComposites != NULL)
   {
      vector<string> names;
      pColorComposites->getAttributeNames(names);
      if (names.empty() == false)
      {
         for (vector<string>::const_iterator iter = names.begin(); iter != names.end(); ++iter)
         {
            pMenu->addAction(QString::fromStdString(*iter));
         }

         mpDisplayBandButton->setEnabled(true);
      }
   }

   QLabel* pRgbStretchTypeLabel = new QLabel("Stretch Type:", pRgbWidget);
   mpRgbStretchTypeCombo = new StretchTypeComboBox(pRgbWidget);

   QPushButton* pRgbStretchFavoritesButton = new QPushButton("Favorites", pRgbWidget);
   mpRgbStretchMenu = new QMenu(pRgbStretchFavoritesButton);
   pRgbStretchFavoritesButton->setMenu(mpRgbStretchMenu);

   mpAddFavoriteRedAction = new QAction("Add Red Stretch to Favorites", pRgbWidget);
   mpAddFavoriteGreenAction = new QAction("Add Green Stretch to Favorites", pRgbWidget);
   mpAddFavoriteBlueAction = new QAction("Add Blue Stretch to Favorites", pRgbWidget);

   LabeledSection* pRgbSection = new LabeledSection(pRgbWidget, "RGB", this);

   QGridLayout* pRgbGrid = new QGridLayout(pRgbWidget);
   pRgbGrid->setMargin(0);
   pRgbGrid->setSpacing(5);
   pRgbGrid->addWidget(pRedLabel, 0, 1);
   pRgbGrid->addWidget(pGreenLabel, 0, 2);
   pRgbGrid->addWidget(pBlueLabel, 0, 3);
   pRgbGrid->addWidget(pRgbElementLabel, 1, 0);
   pRgbGrid->addWidget(mpRedElementCombo, 1, 1);
   pRgbGrid->addWidget(mpGreenElementCombo, 1, 2);
   pRgbGrid->addWidget(mpBlueElementCombo, 1, 3);
   pRgbGrid->addWidget(pRgbBandLabel, 2, 0);
   pRgbGrid->addWidget(mpRedBandCombo, 2, 1);
   pRgbGrid->addWidget(mpGreenBandCombo, 2, 2);
   pRgbGrid->addWidget(mpBlueBandCombo, 2, 3);
   pRgbGrid->addWidget(mpDisplayBandButton, 2, 4);
   pRgbGrid->addWidget(pRgbLowerLabel, 3, 0);
   pRgbGrid->addWidget(mpRedLowerSpin, 3, 1, Qt::AlignLeft);
   pRgbGrid->addWidget(mpGreenLowerSpin, 3, 2, Qt::AlignLeft);
   pRgbGrid->addWidget(mpBlueLowerSpin, 3, 3, Qt::AlignLeft);
   pRgbGrid->addWidget(pRgbStretchFavoritesButton, 3, 4);
   pRgbGrid->addWidget(pRgbUpperLabel, 4, 0);
   pRgbGrid->addWidget(mpRedUpperSpin, 4, 1, Qt::AlignLeft);
   pRgbGrid->addWidget(mpGreenUpperSpin, 4, 2, Qt::AlignLeft);
   pRgbGrid->addWidget(mpBlueUpperSpin, 4, 3, Qt::AlignLeft);
   pRgbGrid->addWidget(pRgbUnitsLabel, 5, 0);
   pRgbGrid->addWidget(mpRedUnitsCombo, 5, 1, Qt::AlignLeft);
   pRgbGrid->addWidget(mpGreenUnitsCombo, 5, 2, Qt::AlignLeft);
   pRgbGrid->addWidget(mpBlueUnitsCombo, 5, 3, Qt::AlignLeft);
   pRgbGrid->addWidget(pRgbStretchTypeLabel, 6, 0);
   pRgbGrid->addWidget(mpRgbStretchTypeCombo, 6, 1, Qt::AlignLeft);
   pRgbGrid->setRowStretch(7, 10);
   pRgbGrid->setColumnStretch(1, 10);
   pRgbGrid->setColumnStretch(2, 10);
   pRgbGrid->setColumnStretch(3, 10);

   // Graphics acceleration
   QLabel* pUnsupportedLabel = new QLabel("Dynamic texture generation is not supported on this system.", this);
   pUnsupportedLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);

   QWidget* pAccelerationWidget = new QWidget(this);
   mpAccelerationCheck = new QCheckBox("Enable Dynamic Generation", pAccelerationWidget);
   mpFilterCheck = new QCheckBox("Filter:", pAccelerationWidget);
   mpFilterList = new QListWidget(pDisplayWidget);
   mpFilterList->setSelectionMode(QAbstractItemView::ExtendedSelection);

   QStringList filterNames;
   Service<ImageFilterManager> pFilterManager;

   vector<string> filters = pFilterManager->getAvailableFilters();
   for (vector<string>::iterator iter = filters.begin(); iter != filters.end(); ++iter)
   {
      string filterName = *iter;
      if (filterName.empty() == false)
      {
         filterNames.append(QString::fromStdString(filterName));
      }
   }

   filterNames.sort();
   mpFilterList->addItems(filterNames);

   QStackedWidget* pAccelerationStack = new QStackedWidget(this);
   LabeledSection* pAccelerationSection = new LabeledSection(pAccelerationStack,
      "Dynamic Texture Generation", this);

   QGridLayout* pAccelerationGrid = new QGridLayout(pAccelerationWidget);
   pAccelerationGrid->setMargin(0);
   pAccelerationGrid->setSpacing(5);
   pAccelerationGrid->addWidget(mpAccelerationCheck, 0, 0, 1, 2);
   pAccelerationGrid->addWidget(mpFilterCheck, 1, 0, Qt::AlignTop);
   pAccelerationGrid->addWidget(mpFilterList, 1, 1, Qt::AlignLeft);
   pAccelerationGrid->setRowStretch(1, 10);
   pAccelerationGrid->setColumnStretch(1, 10);

   bool bUnsupported = true;
#if defined (CG_SUPPORTED)
   if (CgContext::instance() != NULL)
   {
      bUnsupported = false;
   }
#endif

   if (bUnsupported == true)
   {
      pAccelerationStack->addWidget(pUnsupportedLabel);
      pAccelerationWidget->hide();
   }
   else
   {
      pAccelerationStack->addWidget(pAccelerationWidget);
      pUnsupportedLabel->hide();
   }

   // Initialization
   addSection(pDisplaySection);
   addSection(pGrayscaleSection);
   addSection(pRgbSection);
   addSection(pAccelerationSection, 10);
   setSizeHint(600, 610);

   // Connections
   VERIFYNR(mDisplayConfigModifier.attachSignal(mpDisplayModeCombo, SIGNAL(currentIndexChanged(int))));
   VERIFYNR(mDisplayConfigModifier.attachSignal(mpComplexComponentCombo, SIGNAL(valueChanged(ComplexComponent))));
   VERIFYNR(mDisplayConfigModifier.attachSignal(mpOpacitySpin, SIGNAL(valueChanged(int))));

   VERIFYNR(connect(mpGrayElementCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateDisplayedBandCombo(int))));
   VERIFYNR(connect(mpGrayBandCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateStretchValuesFromBand())));
   VERIFYNR(connect(mpGrayStretchMenu, SIGNAL(aboutToShow()), this, SLOT(initializeStretchMenu())));
   VERIFYNR(connect(mpGrayStretchMenu, SIGNAL(triggered(QAction*)), this, SLOT(setGrayStretch(QAction*))));
   VERIFYNR(connect(mpRemoveFavoriteAction, SIGNAL(triggered()), this, SLOT(removeStretchFavorite())));
   VERIFYNR(connect(mpGrayUnitsCombo, SIGNAL(valueChanged(RegionUnits)), this,
      SLOT(updateStretchValuesFromUnits(RegionUnits))));
   VERIFYNR(mGrayscaleModifier.attachSignal(mpGrayElementCombo, SIGNAL(currentIndexChanged(int))));
   VERIFYNR(mGrayscaleModifier.attachSignal(mpGrayBandCombo, SIGNAL(currentIndexChanged(int))));
   VERIFYNR(mGrayscaleModifier.attachSignal(mpGrayLowerSpin, SIGNAL(valueChanged(double))));
   VERIFYNR(mGrayscaleModifier.attachSignal(mpGrayUpperSpin, SIGNAL(valueChanged(double))));
   VERIFYNR(mGrayscaleModifier.attachSignal(mpGrayUnitsCombo, SIGNAL(valueChanged(RegionUnits))));
   VERIFYNR(mGrayscaleModifier.attachSignal(mpGrayStretchTypeCombo, SIGNAL(valueChanged(StretchType))));

   VERIFYNR(connect(mpRedElementCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateDisplayedBandCombo(int))));
   VERIFYNR(connect(mpGreenElementCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateDisplayedBandCombo(int))));
   VERIFYNR(connect(mpBlueElementCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateDisplayedBandCombo(int))));
   VERIFYNR(connect(mpRedBandCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateStretchValuesFromBand())));
   VERIFYNR(connect(mpGreenBandCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateStretchValuesFromBand())));
   VERIFYNR(connect(mpBlueBandCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateStretchValuesFromBand())));
   VERIFYNR(connect(pMenu, SIGNAL(triggered(QAction*)), this, SLOT(setDisplayBands(QAction*))));
   VERIFYNR(connect(mpRgbStretchMenu, SIGNAL(aboutToShow()), this, SLOT(initializeStretchMenu())));
   VERIFYNR(connect(mpRgbStretchMenu, SIGNAL(triggered(QAction*)), this, SLOT(setRgbStretch(QAction*))));
   VERIFYNR(connect(mpRedUnitsCombo, SIGNAL(valueChanged(RegionUnits)), this,
      SLOT(updateStretchValuesFromUnits(RegionUnits))));
   VERIFYNR(connect(mpGreenUnitsCombo, SIGNAL(valueChanged(RegionUnits)), this,
      SLOT(updateStretchValuesFromUnits(RegionUnits))));
   VERIFYNR(connect(mpBlueUnitsCombo, SIGNAL(valueChanged(RegionUnits)), this,
      SLOT(updateStretchValuesFromUnits(RegionUnits))));
   VERIFYNR(mRgbModifier.attachSignal(mpRedElementCombo, SIGNAL(currentIndexChanged(int))));
   VERIFYNR(mRgbModifier.attachSignal(mpGreenElementCombo, SIGNAL(currentIndexChanged(int))));
   VERIFYNR(mRgbModifier.attachSignal(mpBlueElementCombo, SIGNAL(currentIndexChanged(int))));
   VERIFYNR(mRgbModifier.attachSignal(mpRedBandCombo, SIGNAL(currentIndexChanged(int))));
   VERIFYNR(mRgbModifier.attachSignal(mpGreenBandCombo, SIGNAL(currentIndexChanged(int))));
   VERIFYNR(mRgbModifier.attachSignal(mpBlueBandCombo, SIGNAL(currentIndexChanged(int))));
   VERIFYNR(mRgbModifier.attachSignal(mpRedLowerSpin, SIGNAL(valueChanged(double))));
   VERIFYNR(mRgbModifier.attachSignal(mpGreenLowerSpin, SIGNAL(valueChanged(double))));
   VERIFYNR(mRgbModifier.attachSignal(mpBlueLowerSpin, SIGNAL(valueChanged(double))));
   VERIFYNR(mRgbModifier.attachSignal(mpRedUpperSpin, SIGNAL(valueChanged(double))));
   VERIFYNR(mRgbModifier.attachSignal(mpGreenUpperSpin, SIGNAL(valueChanged(double))));
   VERIFYNR(mRgbModifier.attachSignal(mpBlueUpperSpin, SIGNAL(valueChanged(double))));
   VERIFYNR(mRgbModifier.attachSignal(mpRedUnitsCombo, SIGNAL(valueChanged(RegionUnits))));
   VERIFYNR(mRgbModifier.attachSignal(mpGreenUnitsCombo, SIGNAL(valueChanged(RegionUnits))));
   VERIFYNR(mRgbModifier.attachSignal(mpBlueUnitsCombo, SIGNAL(valueChanged(RegionUnits))));
   VERIFYNR(mRgbModifier.attachSignal(mpRgbStretchTypeCombo, SIGNAL(valueChanged(StretchType))));

   VERIFYNR(connect(mpAccelerationCheck, SIGNAL(toggled(bool)), this, SLOT(enableFilterCheck(bool))));
   VERIFYNR(connect(mpFilterCheck, SIGNAL(toggled(bool)), this, SLOT(enableFilterCombo(bool))));
   VERIFYNR(mGraphicsAccModifier.attachSignal(mpAccelerationCheck, SIGNAL(toggled(bool))));
   VERIFYNR(mGraphicsAccModifier.attachSignal(mpFilterCheck, SIGNAL(toggled(bool))));
   VERIFYNR(mGraphicsAccModifier.attachSignal(mpFilterList, SIGNAL(itemSelectionChanged())));
}