Esempio n. 1
0
MainWindow::MainWindow(QWidget *parent)
	: QMainWindow(parent)
{
	// Buttons
	auto buttonsDock = new QDockWidget(tr("Buttons"));
	m_buttonsDockWidget = new QWidget(this);
	auto buttonsLayout = new QGridLayout;
	m_buttonsDockWidget->setLayout(buttonsLayout);
	buttonsDock->setObjectName("ButtonsDock");
	buttonsDock->setWidget(m_buttonsDockWidget);
	buttonsDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
	addDockWidget(Qt::LeftDockWidgetArea, buttonsDock);

	// Graph tree
	m_graphView = new GraphView(this);
	auto graphDock = new QDockWidget(tr("Graph"), this);
	graphDock->setObjectName("GraphDock");
	graphDock->setWidget(m_graphView->view());
	graphDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
	addDockWidget(Qt::LeftDockWidgetArea, graphDock);

	m_openGLView = new OpenGLView(this);
	setCentralWidget(m_openGLView);

	createActions();
	createMenus();

	statusBar();
	
	std::vector<QMenu*> menus = { m_fileMenu, m_toolsMenu, m_viewMenu, m_helpMenu };
	m_simpleGUI = std::make_shared<SimpleGUIImpl>(this, m_openGLView, m_buttonsDockWidget, menus);

	connect(m_graphView, &GraphView::itemOpened, [this](void* item) {
		m_simpleGUI->openPropertiesDialog(static_cast<GraphNode*>(item));
	});

	setWindowIcon(QIcon(":/share/icons/icon.png"));
	setCurrentFile("");
	setAcceptDrops(true);

	readSettings();

	loadModules();

	auto& factory = DocumentFactory::instance();
	if (factory.creatableDocuments().empty())
		m_newAction->setEnabled(false);
	if (factory.loadFilesFilter().empty())
		m_openAction->setEnabled(false);
}
Esempio n. 2
0
PropertyListWidget::PropertyListWidget(QWidget* parent)
    : InviwoDockWidget(tr("Properties"), parent) {
    setObjectName("ProcessorListWidget");
    setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);

    QSizePolicy sp(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding);
    sp.setVerticalStretch(1);
    sp.setHorizontalStretch(1);
    setSizePolicy(sp);

    scrollArea_ = new QScrollArea(this);
    scrollArea_->setWidgetResizable(true);
    scrollArea_->setMinimumWidth(320);
    scrollArea_->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    scrollArea_->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    scrollArea_->setFrameShape(QFrame::NoFrame);
    scrollArea_->setContentsMargins(0, PropertyWidgetQt::SPACING, 0, PropertyWidgetQt::SPACING);

    listWidget_ = new PropertyListFrame(this);
    listLayout_ = new QVBoxLayout();
    listWidget_->setLayout(listLayout_);
    listLayout_->setAlignment(Qt::AlignTop);
    listLayout_->setContentsMargins(0, PropertyWidgetQt::SPACING, 0, PropertyWidgetQt::SPACING);
    listLayout_->setSpacing(7);
    listLayout_->setSizeConstraint(QLayout::SetMinAndMaxSize);

    scrollArea_->setWidget(listWidget_);
    setWidget(scrollArea_);
}
Esempio n. 3
0
PaletteBox::PaletteBox(QWidget* parent)
   : QDockWidget(tr("Palettes"), parent)
      {
      setObjectName("palette-box");
      setAllowedAreas(Qt::DockWidgetAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea));

      PaletteBoxScrollArea* sa = new PaletteBoxScrollArea;
      sa->setFocusPolicy(Qt::NoFocus);
      sa->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
      sa->setContextMenuPolicy(Qt::CustomContextMenu);
      sa->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
      sa->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
      sa->setWidgetResizable(true);
      sa->setFrameShape(QFrame::NoFrame);
      setWidget(sa);

      QWidget* paletteList = new QWidget;
      sa->setWidget(paletteList);
      vbox = new QVBoxLayout;
      paletteList->setLayout(vbox);
      vbox->setMargin(0);
      vbox->setSpacing(1);
      vbox->addStretch();
      paletteList->show();
      }
Esempio n. 4
0
GLFOutputWindow::GLFOutputWindow(QWidget* parent)
    : KxDockWidget(tr("Output"), parent)
{
    setFloating(true);
    setFeatures(QDockWidget::DockWidgetMovable | QDockWidget:: DockWidgetFloatable);
    setAllowedAreas(Qt::NoDockWidgetArea);
    setMinimumSize(640, 120);

    QWidget* mainWidget = new QWidget(this);
    setWidget(mainWidget);

    _pTextEdit = new QTextEdit(this);
    _pTextEdit->setReadOnly(true);

    _pSaveButton = new QPushButton(tr("Save"), this);
    _pClearButton = new QPushButton(tr("Clear"), this);

    connect(_pSaveButton, SIGNAL(clicked()), this, SLOT(onSave()));
    connect(_pClearButton, SIGNAL(clicked()), this, SLOT(onClear()));
    
    QVBoxLayout* mainLayout = new QVBoxLayout(mainWidget);
    mainWidget->setLayout(mainLayout);

    mainLayout->addWidget(_pTextEdit);

    QHBoxLayout* hboxLayout = new QHBoxLayout();
    mainLayout->addLayout(hboxLayout);

    hboxLayout->addStretch();
    hboxLayout->addWidget(_pClearButton);
    hboxLayout->addWidget(_pSaveButton);
}
Esempio n. 5
0
KoToolDocker::KoToolDocker(QWidget *parent)
    : QDockWidget("Tool Options initial name - never seen", parent),
    d( new Private() )
{
    setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::TopDockWidgetArea);
    d->currentWidget = 0;
}
Esempio n. 6
0
TextTools::TextTools(QWidget* parent)
   : QDockWidget(parent)
      {
      _textElement = 0;
      setObjectName("text-tools");
      setWindowTitle(tr("Text Tools"));
      setAllowedAreas(Qt::DockWidgetAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea));

      QToolBar* tb = new QToolBar(tr("Text Edit"));
      tb->setIconSize(QSize(preferences.iconWidth, preferences.iconHeight));

      showKeyboard = getAction("show-keys");
      showKeyboard->setCheckable(true);
      tb->addAction(showKeyboard);

      typefaceBold = tb->addAction(*icons[int(Icons::textBold_ICON)], "");
      typefaceBold->setToolTip(tr("Bold"));
      typefaceBold->setCheckable(true);

      typefaceItalic = tb->addAction(*icons[int(Icons::textItalic_ICON)], "");
      typefaceItalic->setToolTip(tr("Italic"));
      typefaceItalic->setCheckable(true);

      typefaceUnderline = tb->addAction(*icons[int(Icons::textUnderline_ICON)], "");
      typefaceUnderline->setToolTip(tr("Underline"));
      typefaceUnderline->setCheckable(true);

      tb->addSeparator();

      typefaceSubscript   = tb->addAction(*icons[int(Icons::textSub_ICON)], "");
      typefaceSubscript->setToolTip(tr("Subscript"));
      typefaceSubscript->setCheckable(true);

      typefaceSuperscript = tb->addAction(*icons[int(Icons::textSuper_ICON)], "");
      typefaceSuperscript->setToolTip(tr("Superscript"));
      typefaceSuperscript->setCheckable(true);

      tb->addSeparator();

      typefaceFamily = new QFontComboBox(this);
      tb->addWidget(typefaceFamily);

      typefaceSize = new QDoubleSpinBox(this);
      typefaceSize->setFocusPolicy(Qt::ClickFocus);
      tb->addWidget(typefaceSize);

      setWidget(tb);
      QWidget* w = new QWidget(this);
      setTitleBarWidget(w);
      titleBarWidget()->hide();

      connect(typefaceSize,        SIGNAL(valueChanged(double)), SLOT(sizeChanged(double)));
      connect(typefaceFamily,      SIGNAL(currentFontChanged(const QFont&)), SLOT(fontChanged(const QFont&)));
      connect(typefaceBold,        SIGNAL(triggered(bool)), SLOT(boldClicked(bool)));
      connect(typefaceItalic,      SIGNAL(triggered(bool)), SLOT(italicClicked(bool)));
      connect(typefaceUnderline,   SIGNAL(triggered(bool)), SLOT(underlineClicked(bool)));
      connect(typefaceSubscript,   SIGNAL(triggered(bool)), SLOT(subscriptClicked(bool)));
      connect(typefaceSuperscript, SIGNAL(triggered(bool)), SLOT(superscriptClicked(bool)));
      connect(showKeyboard,        SIGNAL(triggered(bool)), SLOT(showKeyboardClicked(bool)));
      }
Esempio n. 7
0
ToolsBar::ToolsBar(QWidget *parent)
    : QDockWidget(parent)
{
	m_currentTool = Handler;
	setWindowTitle(tr("Tools"));
	setObjectName("ToolsBar");

    setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
	setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);

    m_mainWidget = new QWidget(this);

    setWidget(m_mainWidget);

    createActions();
    createTools();

    connect(m_resetCountAct, SIGNAL(triggered(bool)), this, SLOT(resetNpcNumber()));
	connect(m_textEdit, SIGNAL(textEdited(const QString &)), this, SIGNAL(currentTextChanged(QString)));
	connect(m_npcNameEdit, SIGNAL(textEdited(const QString &)), this, SIGNAL(currentNpcNameChanged(QString)));

	connect(this, SIGNAL(topLevelChanged(bool)), this, SLOT(changeSize(bool)));

	setFloating(false);
}
Esempio n. 8
0
RegisterWidget::RegisterWidget(QWidget* parent) : QDockWidget(parent)
{
  setWindowTitle(tr("Registers"));
  setAllowedAreas(Qt::AllDockWidgetAreas);

  QSettings settings;

  restoreGeometry(settings.value(QStringLiteral("registerwidget/geometry")).toByteArray());
  setFloating(settings.value(QStringLiteral("registerwidget/floating")).toBool());

  CreateWidgets();
  PopulateTable();
  ConnectWidgets();

  connect(&Settings::Instance(), &Settings::EmulationStateChanged, [this](Core::State state) {
    if (Settings::Instance().IsDebugModeEnabled() && Core::GetState() == Core::State::Paused)
      emit RequestTableUpdate();
  });

  connect(this, &RegisterWidget::RequestTableUpdate, [this] {
    m_updating = true;
    emit UpdateTable();
    m_updating = false;
  });

  connect(&Settings::Instance(), &Settings::RegistersVisibilityChanged,
          [this](bool visible) { setHidden(!visible); });

  connect(&Settings::Instance(), &Settings::DebugModeToggled, [this](bool enabled) {
    setHidden(!enabled || !Settings::Instance().IsRegistersVisible());
  });

  setHidden(!Settings::Instance().IsRegistersVisible() ||
            !Settings::Instance().IsDebugModeEnabled());
}
Esempio n. 9
0
//program管理
CprogManage:: CprogManage(QWidget *parent):QDockWidget(tr("节目管理"), parent)
{
  setAllowedAreas(Qt::LeftDockWidgetArea);
  treeWidget = new QTreeWidget(this);//(this);

  treeWidget->setHeaderHidden(true);//header()->setVisible(false);

  //QObject::connect(treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)),
    //      this, SLOT(clickItem(QTreeWidgetItem *, int)));
  setWidget(treeWidget);

  setFeatures(QDockWidget::NoDockWidgetFeatures);

  //previewWin = new QMainWindow(w);
  //previewArea =  new CscreenArea;
/*
  previewWin = new QMainWindow(w);
  previewWin->setWindowModality(Qt::WindowModal);

  previewArea =  new CscreenArea;//(previewWin);
  previewArea->setWindowModality(Qt::WindowModal);
  previewArea->previewFlag = 1;

  previewWin->setCentralWidget(previewArea);
  //QDialog d(previewArea);
*/


}
Esempio n. 10
0
PythonEditorWidget::PythonEditorWidget(QWidget* parent)
    : InviwoDockWidget(tr("Python Editor"), parent)
    , settings_("Inviwo", "Inviwo")
    , infoTextColor_(153, 153, 153)
    , errorTextColor_(255, 107, 107)
    , script_()
    , unsavedChanges_(false) {
    ivwAssert(instance_ == nullptr, "This is a Singelton, constructor may only be called once")
        instance_ = this;
    setObjectName("PythonEditor");
    settings_.beginGroup("PythonEditor");
    QString lastFile = settings_.value("lastScript", "").toString();
    settings_.endGroup();
    setVisible(false);
    buildWidget();
    resize(500, 700);
    
    InviwoApplication::getPtr()->registerFileObserver(this);
    unsavedChanges_ = false;



    if (lastFile.size() != 0) loadFile(lastFile.toLocal8Bit().constData(), false);

    setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
    setFloating(true);
}
Esempio n. 11
0
BrowserDock::BrowserDock( QWidget *parent )
    : AmarokDockWidget( i18n( "&Media Sources" ), parent )
{
    setObjectName( "Media Sources dock" );
    setAllowedAreas( Qt::AllDockWidgetAreas );

    //we have to create this here as it is used when setting up the
    //categories (unless of course we move that to polish as well...)
    m_mainWidget = new KVBox( this );
    setWidget( m_mainWidget );
    m_mainWidget->setContentsMargins( 0, 0, 0, 0 );
    m_mainWidget->setFrameShape( QFrame::NoFrame );
    m_mainWidget->setMinimumWidth( 200 );
    m_mainWidget->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Ignored );
    m_mainWidget->setFocus( Qt::ActiveWindowFocusReason );

    m_breadcrumbWidget = new BrowserBreadcrumbWidget( m_mainWidget );
    new HorizontalDivider( m_mainWidget );
    m_categoryList = new BrowserCategoryList( "root list", m_mainWidget );
    m_breadcrumbWidget->setRootList( m_categoryList.data() );

    m_messageArea = new BrowserMessageArea( m_mainWidget );
    m_messageArea->setAutoFillBackground( true );
    m_messageArea->setFixedHeight( 36 );

    Amarok::Logger *logger = Amarok::Components::logger();
    ProxyLogger *proxy = dynamic_cast<ProxyLogger *>( logger );
    if( proxy )
        proxy->setLogger( m_messageArea );
    else
        error() << "Was not able to register BrowserDock as logger";

    ensurePolish();
}
Esempio n. 12
0
void FunctionListArea::generalSetting()
{
    QWidget *widget = new QWidget();
    QHBoxLayout *layout = new QHBoxLayout();
    QLabel *label = new QLabel(tr("函数列表:"), this);
    widget->setLayout(layout);
    layout->addWidget(label);
    layout->addWidget(functionListBox, 1);
    setTitleBarWidget(widget);
    setWidget(new QWidget());
    setFixedHeight(24);
    layout->setContentsMargins(5, 4, 5, 0);

    connect(functionListBox, 
                SIGNAL(activated(int)),
            this,
                SLOT(cursorMove(int))
           );
    connect(functionListBox, 
                SIGNAL(updateFunctionList()), 
            this, 
                SLOT(createFunctionList())
           );
    QFont afont(font());
    afont.setPointSize(10);
    setFont(afont);
    setWindowTitle(tr(""));
    setAllowedAreas(Qt::TopDockWidgetArea);
    setFeatures(QDockWidget::DockWidgetClosable);
                //QDockWidget::DockWidgetVerticalTitleBar);
    QMainWindow *main = qobject_cast<QMainWindow *>(parent());
    main->addDockWidget(Qt::TopDockWidgetArea, this);
    hide();//默认关闭
}
Esempio n. 13
0
HelpWidget::HelpWidget(QWidget* parent)
    : InviwoDockWidget(tr("Help"), parent), helpBrowser_(nullptr), helpEngine_(nullptr) {
    setObjectName("HelpWidget");
    setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);

    QWidget* centralWidget = new QWidget();
    QVBoxLayout* vLayout = new QVBoxLayout(centralWidget);
    vLayout->setSpacing(7);
    vLayout->setContentsMargins(0, 0, 0, 0);

    std::string helpfile =
        InviwoApplication::getPtr()->getPath(InviwoApplication::PATH_HELP, "/inviwo.qhc");

    helpEngine_ = new QHelpEngineCore(QString::fromStdString(helpfile), this);

    helpBrowser_ = new HelpBrowser(this, helpEngine_);
    helpBrowser_->setHtml(QString("Hello world"));
    vLayout->addWidget(helpBrowser_);
    centralWidget->setLayout(vLayout);
    setWidget(centralWidget);

    connect(helpEngine_, SIGNAL(setupFinished()), this, SLOT(setupFinished()));

    if (!helpEngine_->setupData()) {
        LogWarn("Faild to setup the help engine:" << helpEngine_->error().toUtf8().constData());
        delete helpEngine_;
        helpEngine_ = nullptr;
    }
}
Esempio n. 14
0
WaterTool::WaterTool( QWidget* p_parent /*= 0*/ ): QDockWidget(p_parent)
{
	QWidget* contents = new QWidget();

	ui.setupUi(contents);

	setAllowedAreas(Qt::BottomDockWidgetArea|Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea);
	setGeometry(ui.gridLayout->geometry());
	setWindowTitle("Water settings");
	setFloating(true);
	hide();

	setWidget(contents);

	m_colorDialog = new QColorDialog(this);
	m_colorDialog->setWindowModality(Qt::NonModal);

	connect(m_colorDialog, SIGNAL(currentColorChanged(const QColor&)), this, SLOT(SetWaterColor(const QColor&)));


	//Connect items from UI to methods
	connect(ui.doubleSpinBox_waterSpeed,	SIGNAL(valueChanged(double)),	this, SLOT(SetWaterSpeed(double)));
	connect(ui.doubleSpinBox_waterDepth,	SIGNAL(valueChanged(double)),	this, SLOT(SetWaterDepth(double)));
	connect(ui.checkBox_waterReflections,	SIGNAL(clicked(bool)),			this, SLOT(SetWaterReflections(bool)));
	connect(ui.checkBox_waterRefractions,	SIGNAL(clicked(bool)),			this, SLOT(SetWaterRefractions(bool)));
	connect(ui.checkBox_waterNormals,		SIGNAL(clicked(bool)),			this, SLOT(SetWaterNormals(bool)));
	connect(ui.checkBox_waterPause,			SIGNAL(clicked(bool)),			this, SLOT(SetWaterPause(bool)));
	connect(ui.pushButton_waterColor,		SIGNAL(clicked()),				this, SLOT(OpenColorDialog()));
	connect(ui.pushButton_initWater,		SIGNAL(clicked()),				this, SLOT(InitWater()));
	connect(ui.pushButton_resetWater,		SIGNAL(clicked()),				this, SLOT(ResetWater()));

	
}
Esempio n. 15
0
HelpBrowserDocklet::HelpBrowserDocklet( QWidget *parent ):
    Docklet(tr("Help browser"), parent)
{
    mHelpBrowser = new HelpBrowser;

    setAllowedAreas(Qt::AllDockWidgetAreas);
    setWidget(mHelpBrowser);

    mFindBox = new HelpBrowserFindBox();

    toolBar()->addWidget( mHelpBrowser->loadProgressIndicator(), 1 );
    toolBar()->addAction( mHelpBrowser->mActions[HelpBrowser::GoHome] );
    toolBar()->addAction( mHelpBrowser->mWebView->pageAction(QWebPage::Back) );
    toolBar()->addAction( mHelpBrowser->mWebView->pageAction(QWebPage::Forward) );
    toolBar()->addAction( mHelpBrowser->mWebView->pageAction(QWebPage::Reload) );
    toolBar()->addWidget( mFindBox );

    connect( mFindBox, SIGNAL(query(QString, bool)),
             mHelpBrowser, SLOT(findText(QString, bool)) );

    connect(Main::scProcess(), SIGNAL(started()), this, SLOT(onInterpreterStart()));

    OverridingAction * action;
    action = new OverridingAction(this);
    action->setShortcut(QKeySequence::Find);
    action->addToWidget(mHelpBrowser);
    action->addToWidget(toolBar());
    connect( action, SIGNAL(triggered(bool)), mFindBox, SLOT(setFocus()) );
    connect( action, SIGNAL(triggered(bool)), mFindBox, SLOT(selectAll()) );
}
Esempio n. 16
0
TupConfigurationArea::TupConfigurationArea(QWidget *parent) : QDockWidget(parent), k(new Private)
{
    k->toolTipShowed = false;
    setAllowedAreas(Qt::RightDockWidgetArea);

    connect(&k->shower, SIGNAL(timeout()), this, SLOT(showConfigurator()));
}
Esempio n. 17
0
PaletteBox::PaletteBox(QWidget* parent)
   : QDockWidget(tr("Palettes"), parent)
      {
      setObjectName("palette-box");
      setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);

      QScrollArea* sa = new QScrollArea;
      sa->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
      sa->setContextMenuPolicy(Qt::CustomContextMenu);
      sa->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
      sa->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
      sa->setWidgetResizable(true);
      setWidget(sa);

      QWidget* paletteList = new QWidget;
      sa->setWidget(paletteList);
      vbox = new QVBoxLayout;
      paletteList->setLayout(vbox);
      _dirty = false;
      vbox->setMargin(0);
      vbox->setSpacing(1);
      vbox->addStretch();
      paletteList->show();

//      connect(sa, SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(contextMenu(const QPoint&)));
      }
Esempio n. 18
0
BtModuleChooserBar::BtModuleChooserBar(QWidget *parent)
        : QToolBar(parent),
        BtWindowModuleChooser(CSwordModuleInfo::Unknown, nullptr),
        m_idCounter(0),
        m_window(nullptr) {
    setAllowedAreas(Qt::TopToolBarArea);
    setFloatable(false);
}
Esempio n. 19
0
ToolBar::ToolBar (QWidget *parent = NULL) : QToolBar(parent)
{
  setAllowedAreas(Qt::AllToolBarAreas);
  setMovable(true);
  setFloatable(true);

  initActions();
}
ShapePropertiesDocker::ShapePropertiesDocker(QWidget *parent)
    : QDockWidget(i18n("Shape Properties"), parent),
    d( new Private() )
{
    setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
    d->widgetStack = new QStackedWidget();
    setWidget(d->widgetStack);
}
Esempio n. 21
0
BaseTreeDock::BaseTreeDock(QString window_title, QString object_name, bool requires_refresh, QWidget *parent, Qt::WindowFlags flags)
    : BaseDock(parent, flags)
    , m_collapsed(true)
{
    setWindowTitle(window_title);
    setObjectName(object_name);
    setFeatures(QDockWidget::AllDockWidgetFeatures);
    setAllowedAreas(Qt::AllDockWidgetAreas);

    m_arr_in = QIcon(":img/arrow-in.png");
    m_arr_out = QIcon(":img/arrow-out.png");

    QWidget *w = new QWidget();
    QVBoxLayout *l = new QVBoxLayout();
    w->setLayout(l);

    m_tree_view = new QTreeWidget(this);
    m_tree_view->setEditTriggers(QAbstractItemView::NoEditTriggers);
    m_tree_view->setDropIndicatorShown(false);
    m_tree_view->setProperty("showSortIndicator",QVariant(true));
    m_tree_view->setSelectionMode(QAbstractItemView::ExtendedSelection);

    QHBoxLayout *s = new QHBoxLayout();
    QLabel *lbl_search = new QLabel(tr("Search"),this);
    s->addWidget(lbl_search);
    m_le_search = new QLineEdit(this);
    m_le_search->setObjectName("le_search");
    s->addWidget(m_le_search);

    m_btn_toggle_tree = new QPushButton(this);
    m_btn_toggle_tree->setIcon(m_arr_out);
    s->addWidget(m_btn_toggle_tree);

    QPushButton *btn_clear_search = new QPushButton(this);
    QIcon icn_cross(":img/cross.png");
    btn_clear_search->setIcon(icn_cross);
    s->addWidget(btn_clear_search);

    l->addLayout(s);

    QPushButton *btn = new QPushButton(tr("Clear Filter"),this);
    w->layout()->addWidget(m_tree_view);
    w->layout()->addWidget(btn);

    setWidget(w);

    connect(btn, SIGNAL(clicked()),this,SLOT(clear_filter()));
    connect(m_le_search, SIGNAL(textChanged(QString)), this, SLOT(search_changed(QString)));
    connect(btn_clear_search, SIGNAL(clicked()),this,SLOT(clear_search()));
    connect(m_btn_toggle_tree, SIGNAL(clicked()), this, SLOT(toggle_tree()));
    connect(m_tree_view, SIGNAL(itemSelectionChanged()), this, SLOT(selection_changed()));

    m_requires_refresh = requires_refresh;

    if(DT){
        connect(DT,SIGNAL(units_refreshed()),this,SLOT(refresh()));
    }
}
Esempio n. 22
0
void DockWidget::setState(bool edit) {
    QDockWidget::DockWidgetFeatures features;
    if (edit) {
        setAllowedAreas(Qt::AllDockWidgetAreas);
        features = QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable;
        if (isClosable()) {
            features |= QDockWidget::DockWidgetClosable;
        }
    } else {
        setAllowedAreas(Qt::NoDockWidgetArea);
        features = QDockWidget::NoDockWidgetFeatures;
        if (isFloating()) {
            features |= QDockWidget::DockWidgetFloatable;
        }
    }
    setFeatures(features);
    setTitleBarWidget(isFloating() || edit ? Q_NULLPTR : m_titleHide);
}
Esempio n. 23
0
PaletteBox::PaletteBox(QWidget* parent)
   : QDockWidget(tr("Palettes"), parent)
      {
      setContextMenuPolicy(Qt::ActionsContextMenu);
      setObjectName("palette-box");
      setAllowedAreas(Qt::DockWidgetAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea));

      QAction* a = new QAction(this);
      a->setText(tr("Single Palette"));
      a->setCheckable(true);
      a->setChecked(preferences.singlePalette);
      addAction(a);
      connect(a, SIGNAL(toggled(bool)), SLOT(setSinglePalette(bool)));

      QWidget* w = new QWidget(this);
      w->setContextMenuPolicy(Qt::NoContextMenu);
      QVBoxLayout* vl = new QVBoxLayout(w);
      vl->setMargin(0);
      QHBoxLayout* hl = new QHBoxLayout;
      hl->setContentsMargins(5,5,5,0);

      workspaceList = new QComboBox;
      workspaceList->setToolTip(tr("Select workspace"));
      updateWorkspaces();
      hl->addWidget(workspaceList);
      QToolButton* nb = new QToolButton;

      nb->setMinimumHeight(27);
      nb->setText(tr("+"));
      nb->setToolTip(tr("Add new workspace"));
      hl->addWidget(nb);

      setWidget(w);

      PaletteBoxScrollArea* sa = new PaletteBoxScrollArea;
      sa->setFocusPolicy(Qt::NoFocus);
      sa->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
      sa->setContextMenuPolicy(Qt::CustomContextMenu);
      sa->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
      sa->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
      sa->setWidgetResizable(true);
      sa->setFrameShape(QFrame::NoFrame);
      vl->addWidget(sa);
      vl->addLayout(hl);

      QWidget* paletteList = new QWidget;
      sa->setWidget(paletteList);
      vbox = new QVBoxLayout;
      paletteList->setLayout(vbox);
      vbox->setMargin(0);
      vbox->setSpacing(1);
      vbox->addStretch();
      paletteList->show();

      connect(nb, SIGNAL(clicked()), SLOT(newWorkspaceClicked()));
      connect(workspaceList, SIGNAL(activated(int)), SLOT(workspaceSelected(int)));
      }
Esempio n. 24
0
MainDock::MainDock(QWidget* parent) : QDockWidget("Control dock", parent) {

	settings = new DrawSettings;

	setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable );
	setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);

	widget = new QWidget;
	layout = new QVBoxLayout;
	widget->setLayout(layout);
	setWidget(widget);


	createMenu();
	layout->addWidget(menuBar);

	splitter = new QSplitter;
	splitter->setOrientation(Qt::Vertical);
	layout->addWidget(splitter);


	//creating the list of widgets
	listWidget = new QWidget(this);
	scrollArea = new QScrollArea(this);
	listWidgetLayout = new QVBoxLayout(listWidget);
	listWidget->setLayout(listWidgetLayout);
	scrollArea->setWidget(listWidget);
	scrollArea->setWidgetResizable(true);
	splitter->insertWidget(0, scrollArea);

	ILWidget = new QWidget(this);
	ILScrollArea = new QScrollArea(this);
	ILLayout = new QVBoxLayout(ILWidget);
	ILWidget->setLayout(ILLayout);
	ILScrollArea->setWidget(ILWidget);
	ILScrollArea->setWidgetResizable(true);
	splitter->insertWidget(1, ILScrollArea);

	//nasty, set the widget type, then call the function to toggle it and set anything necessary
	widgetType = 1;
	toggleWidgetType();

	//problems with the size here
	ILWidget->setMinimumSize(300, 300);

// 	//mem leaks test:
// 	WorldEmisar temp;
// 	for( int i = 0; ;i++ ) {
// 		WorldEmisarWidget* xxx = new WorldEmisarWidget(&temp);
// 		emisarList << xxx;
// 		delete emisarList.takeAt(0);
// 		if (i % 200 == 0)
// 			qDebug() << i;
// 	}

	showComponents = true;
}
Esempio n. 25
0
KoModeBoxDocker::KoModeBoxDocker(KoModeBox *modeBox)
    : m_modeBox(modeBox)
{
    setWidget(modeBox);
    setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
    setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
    setWindowTitle("");
    setObjectName("ModeBox");
}
Esempio n. 26
0
int QToolBar::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 13)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 13;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< bool*>(_v) = isMovable(); break;
        case 1: *reinterpret_cast< Qt::ToolBarAreas*>(_v) = allowedAreas(); break;
        case 2: *reinterpret_cast< Qt::Orientation*>(_v) = orientation(); break;
        case 3: *reinterpret_cast< QSize*>(_v) = iconSize(); break;
        case 4: *reinterpret_cast< Qt::ToolButtonStyle*>(_v) = toolButtonStyle(); break;
        case 5: *reinterpret_cast< bool*>(_v) = isFloating(); break;
        case 6: *reinterpret_cast< bool*>(_v) = isFloatable(); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setMovable(*reinterpret_cast< bool*>(_v)); break;
        case 1: setAllowedAreas(*reinterpret_cast< Qt::ToolBarAreas*>(_v)); break;
        case 2: setOrientation(*reinterpret_cast< Qt::Orientation*>(_v)); break;
        case 3: setIconSize(*reinterpret_cast< QSize*>(_v)); break;
        case 4: setToolButtonStyle(*reinterpret_cast< Qt::ToolButtonStyle*>(_v)); break;
        case 6: setFloatable(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        bool *_b = reinterpret_cast<bool*>(_a[0]);
        switch (_id) {
        case 0: *_b = (qobject_cast<QMainWindow*>(parentWidget())!=0); break;
        case 1: *_b = (qobject_cast<QMainWindow*>(parentWidget())!=0); break;
        case 2: *_b = (qobject_cast<QMainWindow*>(parentWidget())==0); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 7;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Esempio n. 27
0
Panel::Panel(QWidget* parent, Qt::WindowFlags flags):
	QDockWidget(parent, flags)
{
	setContextMenuPolicy(Qt::CustomContextMenu);
	setFocusPolicy(Qt::NoFocus);

	setAllowedAreas(Qt::AllDockWidgetAreas);
	connect(this, &Panel::customContextMenuRequested,
	        this, &Panel::onContextMenuRequest);
}
Esempio n. 28
0
PythonInfoWidget::PythonInfoWidget(QWidget* parent)
    :  InviwoDockWidget(tr("Python API Documentation"),parent) {
    setObjectName("PythonInfoWidget");
    setVisible(false);
    buildWidget();
    resize(500, 900);

    setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
    setFloating(true);
}
Esempio n. 29
0
LogConfigWidget::LogConfigWidget(QWidget* parent) : QDockWidget(parent)
{
  setWindowTitle(tr("Log Configuration"));
  setHidden(!Settings::Instance().IsLogConfigVisible());
  setAllowedAreas(Qt::AllDockWidgetAreas);

  CreateWidgets();
  LoadSettings();
  ConnectWidgets();
}
Esempio n. 30
0
ToolBar::ToolBar (QWidget *parent) :
    QToolBar(parent)
{
    wheelEventState = false;
    setAllowedAreas(Qt::AllToolBarAreas);
    setMovable(true);
    setFloatable(true);

    initActions();
}