Esempio n. 1
0
void GalleryUtil::PlayVideo(const QString &filename)
{
    // HACK begin - remove when everything is using mythui
    vector<QWidget *> widgetList;
    if (GetMythMainWindow()->currentWidget())
    {
        QWidget *widget = GetMythMainWindow()->currentWidget();

        while (widget)
        {
            widgetList.push_back(widget);
            GetMythMainWindow()->detach(widget);
            widget->hide();
            widget = GetMythMainWindow()->currentWidget();
        }

        GetMythMainWindow()->GetPaintWindow()->raise();
        GetMythMainWindow()->GetPaintWindow()->setFocus();
        //GetMythMainWindow()->ShowPainterWindow();
    }
    // HACK end

    GetMythMainWindow()->HandleMedia("Internal", filename);


    // HACK begin - remove when everything is using mythui
    vector<QWidget*>::reverse_iterator it;
    for (it = widgetList.rbegin(); it != widgetList.rend(); ++it)
    {
        GetMythMainWindow()->attach(*it);
        (*it)->show();
    }
    //GetMythMainWindow()->HidePainterWindow();
    // HACK end
}
Esempio n. 2
0
void PlotMarkerLegend::updateLegend(QwtLegend* legend) const
{
	if ( legend == NULL )
		return;

	if ( legend && testItemAttribute( QwtPlotItem::Legend ) && symbol() && symbol()->style() != QwtSymbol::NoSymbol )
	{
		QWidget *lgdItem = legend->find( this );
		if ( lgdItem == NULL )
		{
			lgdItem = legendItem();
			if ( lgdItem )
				legend->insert( this, lgdItem );
		}

		LegendItem *l = qobject_cast<LegendItem *>( lgdItem );
		if ( l )
			l->setIdentifierSize( symbol()->boundingSize() );
	}

	QWidget *lgdItem = legend->find( this );
	if ( testItemAttribute( QwtPlotItem::Legend ) )
	{
		LegendItem *label = qobject_cast<LegendItem *>( lgdItem );
		if ( label )
		{
			// paint the identifier
			const QSize sz = label->identifierSize();

			QPixmap identifier( sz.width(), sz.height() );
			identifier.fill( Qt::transparent );

			QPainter painter( &identifier );
			painter.setRenderHint( QPainter::Antialiasing, testRenderHint( QwtPlotItem::RenderAntialiased ) );
			drawLegendIdentifier( &painter, QRect( 0, 0, sz.width(), sz.height() ) );
			painter.end();

			const bool doUpdate = label->updatesEnabled();
			if ( doUpdate )
				label->setUpdatesEnabled( false );

			label->setText( title() );
			label->setIdentifier( identifier );
			label->setItemMode( legend->itemMode() );

			if ( doUpdate )
				label->setUpdatesEnabled( true );

			label->update();
		}
	}
	else
	{
		if ( lgdItem )
		{
			lgdItem->hide();
			lgdItem->deleteLater();
		}
	}
}
Esempio n. 3
0
bool DockPlugin::eventFilter(QObject *o, QEvent *e)
{
    if (o == m_popup)
    {
        if (e->type() == QEvent::Hide)
        {
            m_popup->removeEventFilter(this);
            m_popup = NULL;
        }
    }else{
        switch (e->type())
        {
        case QEvent::Close:
            if (!m_bQuit)
            {
                QWidget *main = static_cast<QWidget*>(o);
                setValue("ShowMain", false); 
                //setShowMain(false);
                main->hide();
				e->ignore();
                return true;
            }
            break;
        case QEvent::WindowDeactivate:
            m_inactiveTime = QDateTime::currentDateTime();
            break;
        case QEvent::WindowActivate:
            m_inactiveTime = QDateTime();
            break;
        default:
            break;
        }
    }
    return QObject::eventFilter(o, e);
}
Esempio n. 4
0
void ItemDelegate::setIndexWidget(const QModelIndex &index, ItemWidget *w)
{
    reset(&m_cache[index.row()], w);
    if (w == NULL)
        return;

    QWidget *ww = w->widget();

    if (!m_antialiasing) {
        QFont f = ww->font();
        f.setStyleStrategy(QFont::NoAntialias);
        ww->setFont(f);
        foreach (QWidget *child, ww->findChildren<QWidget *>("item_child"))
            child->setFont(f);
    }

    // Try to get proper size by showing item momentarily.
    ww->show();
    w->updateSize(m_maxSize, m_idealWidth);
    ww->hide();

    ww->installEventFilter(this);

    w->setCurrent(m_view->currentIndex() == index);

    emit rowSizeChanged();
}
Esempio n. 5
0
bool DockPlugin::eventFilter(QObject *o, QEvent *e)
{
    if (o == m_popup){
        if (e->type() == QEvent::Hide){
#if COMPAT_QT_VERSION < 0x030000
            m_popup->releaseMouse();
#endif
            m_popup->removeEventFilter(this);
            m_popup = NULL;
        }
    }else{
        switch (e->type()){
        case QEvent::Close:
            if (!bQuit){
                QWidget *main = (QWidget*)o;
                setShowMain(false);
                main->hide();
                return true;
            }
            break;
        case QEvent::WindowDeactivate:
            time((time_t*)&inactiveTime);
            break;
        case QEvent::WindowActivate:
            inactiveTime = 0;
            break;
        default:
            break;
        }
    }
    return QObject::eventFilter(o, e);
}
Esempio n. 6
0
bool DockPlugin::eventFilter(QObject *o, QEvent *e)
{
    if (o == m_popup){
        if (e->type() == QEvent::Hide){
            m_popup = NULL;
        }
    }else{
        switch (e->type()){
        case QEvent::Close:
            if (!bQuit){
                QWidget *main = (QWidget*)o;
                setShowMain(false);
                main->hide();
                return true;
            }
            break;
        case QEvent::WindowDeactivate:
            time((time_t*)&inactiveTime);
            break;
        case QEvent::WindowActivate:
            inactiveTime = 0;
            break;
        default:
            break;
        }
    }
    return QObject::eventFilter(o, e);
}
Esempio n. 7
0
/*!
    \property QStackedLayout::currentIndex
    \brief the index position of the widget that is visible

    The current index is -1 if there is no current widget.

    \sa currentWidget(), indexOf()
*/
void QStackedLayout::setCurrentIndex(int index)
{
    Q_D(QStackedLayout);
    QWidget *prev = currentWidget();
    QWidget *next = widget(index);
    if (!next || next == prev)
        return;

    bool reenableUpdates = false;
    QWidget *parent = parentWidget();

    if (parent && parent->updatesEnabled()) {
        reenableUpdates = true;
        parent->setUpdatesEnabled(false);
    }

    QPointer<QWidget> fw = parent ? parent->window()->focusWidget() : 0;
    const bool focusWasOnOldPage = fw && (prev && prev->isAncestorOf(fw));

    if (prev) {
        prev->clearFocus();
        if (d->stackingMode == StackOne)
            prev->hide();
    }

    d->index = index;
    next->raise();
    next->show();

    // try to move focus onto the incoming widget if focus
    // was somewhere on the outgoing widget.

    if (parent) {
        if (focusWasOnOldPage) {
            // look for the best focus widget we can find
            if (QWidget *nfw = next->focusWidget())
                nfw->setFocus();
            else {
                // second best: first child widget in the focus chain
                if (QWidget *i = fw) {
                    while ((i = i->nextInFocusChain()) != fw) {
                        if (((i->focusPolicy() & Qt::TabFocus) == Qt::TabFocus)
                            && !i->focusProxy() && i->isVisibleTo(next) && i->isEnabled()
                            && next->isAncestorOf(i)) {
                            i->setFocus();
                            break;
                        }
                    }
                    // third best: incoming widget
                    if (i == fw )
                        next->setFocus();
                }
            }
        }
    }
    if (reenableUpdates)
        parent->setUpdatesEnabled(true);
    emit currentChanged(index);
}
Esempio n. 8
0
void StatusBarLayout::setGeometry( const QRect& _rect )
{
    QLayout::setGeometry( _rect );

    if( mIsDirty )
        updateLayoutStructs();

    QRect rect( 0, 0, _rect.width(), _rect.height() );

    const int margin = 0;//this->margin();
    const int spacing = this->spacing();

    int availableWidth =        rect.size().width()  - 2*margin;
    const int availableHeight = rect.size().height() - 2*margin;

    int usedWidth = 0;
    int visibleCount = 0;
    int i;
    for( i = 0; i<mWidgetList.count(); ++i )
    {
        QWidgetItem* item = mWidgetList.at( i );
        QWidget* widget = item->widget();

        // TODO: is there really no way to get to the geometry data if a widget is hidden?
        if( widget->isHidden() )
            widget->show();

        const int itemWidth = item->sizeHint().width();
        const int itemSpacing = ( visibleCount == 0 ) ? 0 : spacing;
        const int newUsedWidth = usedWidth + itemSpacing + itemWidth;
// kDebug()<<widget<<<<availableWidth<<usedWidth<<itemWidth<<itemSpacing<<newUsedWidth;

        const bool isTooWide = ( newUsedWidth > availableWidth );

        if( isTooWide )
            break;

        const QPoint pos( margin + usedWidth, margin );
        const QSize size( itemWidth, availableHeight );
        QRect r( pos, size );

        r = QStyle::visualRect( parentWidget()->layoutDirection(), rect, r );

        item->setGeometry( r );

        usedWidth = newUsedWidth;

        ++visibleCount;
    }
    // hide the rest if needed
    for( ; i<mWidgetList.count(); ++i )
    {
        QWidgetItem* item = mWidgetList.at( i );
        QWidget* widget = item->widget();

        if( ! widget->isHidden() )
            widget->hide();
    }
}
Esempio n. 9
0
void VideoWidget::toogleVisibility()
{
    QWidget* widget = dynamic_cast<QWidget*>(this);
    if(widget->isVisible())
        widget->hide();
    else
        widget->show();
}
Esempio n. 10
0
void PlayerDemo::closeEvent(QCloseEvent *event)
{
	// Close window, stop player, and quit
	QWidget *pWin = QApplication::activeWindow();
	pWin->hide();
	player->Stop();
	QApplication::quit();
}
Esempio n. 11
0
void VstPlugin::hideEditor()
{
	QWidget * w = pluginWidget();
	if( w )
	{
		w->hide();
	}
}
Esempio n. 12
0
void pa_db::dock_widget::hideSpecies()
{
	QWidget *spw = qobject_cast<QWidget *>( lblSpeciesList->parent() );
	spw->hide();
	
	//speciesList()->hide();
	//lblSpeciesList->hide();
}
Esempio n. 13
0
QWidget *  medVtkViewItkDataImageNavigator::buildToolBoxWidget()
{
    QWidget *toolBoxWidget = new QWidget;
    QFormLayout *layout = new QFormLayout(toolBoxWidget);
    foreach(medAbstractParameterL *parameter, d->parameters)
        layout->addRow(parameter->getLabel(), parameter->getWidget());
    toolBoxWidget->hide();
    return toolBoxWidget;
}
Esempio n. 14
0
void Dialog::hideView()
{
	QWidget * w = asQWidget();
	if (!w->isVisible())
		return;
	clearParams();
	disconnect();
	w->hide();
}
Esempio n. 15
0
void *DockPlugin::processEvent(Event *e)
{
    if (e->type() == EventInit)
        init();
    if (e->type() == EventRaiseWindow){
        if ((e->param() == getMainWindow()) && !getShowMain())
            return e->param();
    }
    if (e->type() == EventCommandCreate){
        CommandDef *def = (CommandDef*)(e->param());
        if (def->menu_id == MenuMain){
            CommandDef d = *def;
            if (def->flags & COMMAND_IMPORTANT){
                if (d.menu_grp == 0)
                    d.menu_grp = 0x1001;
            }else{
                d.menu_grp = 0;
            }
            d.menu_id = DockMenu;
            d.bar_id  = 0;
            Event e(EventCommandCreate, &d);
            e.process();
        }
    }
    if (e->type() == EventCheckState){
        CommandDef *def = (CommandDef*)(e->param());
        if (def->id == CmdToggle){
            def->flags &= ~COMMAND_CHECKED;
            def->text = isMainShow() ?
                        I18N_NOOP("Hide main window") :
                        I18N_NOOP("Show main window");
            return e->param();
        }
    }
    if (e->type() == EventCommandExec){
        CommandDef *def = (CommandDef*)(e->param());
        if (def->id == CmdToggle){
            QWidget *main = getMainWindow();
            if (isMainShow()){
                setShowMain(false);
                main->hide();
            }else{
                setShowMain(true);
                raiseWindow(main);
            }
            return e->param();
        }
        if (def->id == CmdCustomize){
            Event eCustomize(EventMenuCustomize, (void*)DockMenu);
            eCustomize.process();
            return e->param();
        }
        if (def->id == CmdQuit)
            bQuit = true;
    }
    return NULL;
}
void StackedUtilityPanelController::close(DesignDocumentController* designDocumentController)
{
    QWidget* page = stackedPageWidget(designDocumentController);

    if (m_stackedWidget->children().contains(page)) {
        page->hide();
        m_stackedWidget->removeWidget(page);
    }
}
Esempio n. 17
0
void Window::Show(bool show)
{
    QWidget *w = PWindow(wid);

    if (show)
        w->show();
    else
        w->hide();
}
Esempio n. 18
0
void RequestDialog::hideEvent(QHideEvent * event)
{
    QWidget * parent = parentWidget();

    if (parent && dynamic_cast< QMdiSubWindow* >(parent))
        parent->hide();

    event->accept();
}
Esempio n. 19
0
/*!
  \brief Update the entries for an item

  \param itemInfo Info for an item
  \param data List of legend entry attributes for the item
 */
void QwtLegend::updateLegend( const QVariant &itemInfo, 
    const QList<QwtLegendData> &data )
{
    QList<QWidget *> widgetList = legendWidgets( itemInfo );

    if ( widgetList.size() != data.size() )
    {
        QLayout *contentsLayout = d_data->view->contentsWidget->layout();

        while ( widgetList.size() > data.size() )
        {
            QWidget *w = widgetList.takeLast();

            contentsLayout->removeWidget( w );

            // updates might be triggered by signals from the legend widget
            // itself. So we better don't delete it here.

            w->hide();
            w->deleteLater();
        }

        for ( int i = widgetList.size(); i < data.size(); i++ )
        {
            QWidget *widget = createWidget( data[i] );

            if ( contentsLayout )
                contentsLayout->addWidget( widget );

            if ( isVisible() )
            {
                // QLayout does a delayed show, with the effect, that
                // the size hint will be wrong, when applications
                // call replot() right after changing the list
                // of plot items. So we better do the show now.

                widget->setVisible( true );
            }

            widgetList += widget;
        }

        if ( widgetList.isEmpty() )
        {
            d_data->itemMap.remove( itemInfo );
        }
        else
        {
            d_data->itemMap.insert( itemInfo, widgetList );
        }

        updateTabOrder();
    }
    
    for ( int i = 0; i < data.size(); i++ )
        updateWidget( widgetList[i], data[i] );
}
Esempio n. 20
0
void v3dDataFibers::generateThumbnails() const
{
    d->thumbnails.clear();

    // we must use a parent to prevent infinte recursion of the QVTKWidget
    // see: http://vtk.1045678.n5.nabble.com/qtimageviewer-example-crashes-with-vtk-5-6-0-td1249263.html
    //
    QWidget *parent = new QWidget;

    QVTKWidget *widget = new QVTKWidget (parent);
    QVBoxLayout *l = new QVBoxLayout(parent);
    l->setContentsMargins(0,0,0,0);
    l->addWidget(widget);


    vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
    vtkActor *actor = vtkActor::New();
    vtkRenderer *renderer = vtkRenderer::New();
    vtkRenderWindow *window = vtkRenderWindow::New();
    widget->SetRenderWindow(window);

    parent->setFixedSize(128,128);
    parent->show();

    mapper->SetInput (d->data->GetFibers());
    actor->SetMapper (mapper);
    renderer->AddViewProp(actor);
    window->SetSize (128,128);
    window->AddRenderer (renderer);
    //window->OffScreenRenderingOn();
    renderer->ResetCamera();

    //window->Render();
    parent->update();

    // make sure widget is shown and that openGL context is initialized
    // otherwise, an infinite loop happens when calling GetRGBACharPixelData
    qApp->processEvents();

    unsigned int w=128, h=128;
    d->thumbnail = QImage(w, h, QImage::Format_ARGB32);

    vtkUnsignedCharArray* pixels = vtkUnsignedCharArray::New();
    pixels->SetArray(d->thumbnail.bits(), w*h*4, 1);
    window->GetRGBACharPixelData(0, 0, w-1, h-1, 1, pixels);

    parent->hide();

    d->thumbnails.append (d->thumbnail);

    pixels->Delete();
    mapper->Delete();
    actor->Delete();
    renderer->Delete();
    window->Delete(); // crash if window is deleted
    parent->deleteLater();
}
void tst_QWidget_window::tst_show_resize_hide_show()
{
    QWidget w;
    w.show();
    w.resize(200, 200);
    w.hide();
    w.show();
    QCOMPARE(w.size(), QSize(200, 200));
//    QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
}
void tst_QWidget_window::tst_show_move_hide_show()
{
    QWidget w;
    w.show();
    w.move(100, 100);
    w.hide();
    w.show();
    QCOMPARE(w.pos(), QPoint(100, 100));
//    QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
}
void SameSizeLayoutSnapshotChangeDelegateBase::_hideAndSendSignalAboutDeletedItems() {
    int cnt = _currentlyDeletingItems.size();
    for(int i = 0; i < cnt; i++) {
        QWidget *item = _currentlyDeletingItems[i];
        item->hide();
        Q_EMIT itemHiddenAndSafeToRemove(item);
    }

    this->_currentlyDeletingItems.clear();
}
void FLAccessControlForm::processObject(QObject *obj)
{
  FLFormDB *fm = ::qt_cast<FLFormDB *>(obj);
  if (!fm || !acosPerms_)
    return ;

  if (!perm_.isEmpty()) {
    QObjectList *l = fm->queryList("QWidget");
    QObjectListIt ito(*l);
    QWidget *w;
    while ((w = ::qt_cast<QWidget *>(ito.current())) != 0) {
      ++ito;
      if ((*acosPerms_)[ w->name()])
        continue;
      if (perm_ == "-w" || perm_ == "--") {
        w->setPalette(pal);
        w->setDisabled(true);
        w->hide();
        continue;
      }
      if (perm_ == "r-")
        w->setDisabled(true);
    }
    delete l;
  }

  QDictIterator < QString > it(*acosPerms_);
  for (; it.current(); ++it) {
    QWidget *w = ::qt_cast<QWidget * >(fm->child(it.currentKey(), "QWidget"));
    if (w) {
      QString perm = *(*it);
      if (perm == "-w" || perm == "--") {
        w->setPalette(pal);
        w->setDisabled(true);
        w->hide();
        continue;
      }
      if (perm == "r-")
        w->setDisabled(true);
    }
  }
}
Esempio n. 25
0
void MainWindow::on_actionViewToggleCategory_triggered()
{
    QWidget* category = m_splitter->widget(0);
    if (category->isVisible()) {
        category->hide();
    } else {
        category->show();
    }

    m_actions->toggleActionText(WIZACTION_GLOBAL_TOGGLE_CATEGORY);
}
Esempio n. 26
0
LegalInformationDialog::LegalInformationDialog() :
	IconDialogBase(tr("Legal information"), QStyle::SP_MessageBoxInformation)
{
	QLabel *label = new QLabel(tr("Please make sure that recording this call is legal and that all involved parties\nagree with it."));
	vbox->addWidget(label);

	QWidget *additionalInfo = new QWidget;
	additionalInfo->hide();
	QVBoxLayout *additionalInfoLayout = new QVBoxLayout(additionalInfo);
	additionalInfoLayout->setMargin(0);

	additionalInfoLayout->addSpacing(10);

	label = new QLabel(tr(
		"<p>The legality of recording calls depends on whether the involved parties agree<br>"
		"with it and on the laws that apply to their geographic locations.  Here is a<br>"
		"simple rule of thumb:</p>"

		"<p>If all involved parties have been asked for permission to record a call and<br>"
		"agree with the intended use or storage of the resulting file, then recording a<br>"
		"call is probably legal.</p>"

		"<p>If not all involved parties have been asked for permission, or if they don't<br>"
		"explicitely agree with it, or if the resulting file is used for purposes other than<br>"
		"what has been agreed upon, then it's probably illegal to record calls.</p>"

		"<p>For more serious legal advice, consult a lawyer.  For more information, you can<br>"
		"search the internet for '<a href='http://www.google.com/search?q=call+recording+legal'>call recording legal</a>'.</p>"
	));
	label->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse);
	label->setTextFormat(Qt::RichText);
	label->setOpenExternalLinks(true);
	additionalInfoLayout->addWidget(label);

	additionalInfoLayout->addSpacing(10);

	QCheckBox* checkBox = new QCheckBox(tr("Do not show this information again"));
	connect(checkBox, SIGNAL(toggled(bool)), &settings, SLOT(setGuiHideLegalInfo(bool)));
	additionalInfoLayout->addWidget(checkBox);

	vbox->addWidget(additionalInfo);

	QPushButton* button = new QPushButton(tr("More information >>"));
	connect(button, SIGNAL(clicked()), button, SLOT(hide()));
	connect(button, SIGNAL(clicked()), additionalInfo, SLOT(show()));
	vbox->addWidget(button, 0, Qt::AlignLeft);

	button = new QPushButton(tr("&OK"));
	button->setDefault(true);
	connect(button, SIGNAL(clicked()), this, SLOT(close()));
	hbox->addWidget(button, 0, Qt::AlignHCenter);

	show();
}
Esempio n. 27
0
void QmvTextItem::hideEditor()
{
    QmvItem::hideEditor();
    QWidget* w;
    if ( hasMultiLines )
	w = box;
    else
	w = lined();

    w->hide();
}
void FilterInfoPortEditWidget::editCanceled(const PortInfo &info)
{
    Q_UNUSED(info);

    if(!mInEditMode)
        return;
    mInEditMode = false;
    QWidget* widget = mEdit->editWidget();
    if(widget)
        widget->hide();
    setConnected(mConnected);
}
Esempio n. 29
0
void QgsMessageLogViewer::buttonToggled( bool checked )
{
  QWidget *w = qobject_cast<QDockWidget *>( parent() );

  if ( !w )
    w = this;

  if ( checked )
    w->show();
  else
    w->hide();
}
Esempio n. 30
0
void LinuxTools::collapseWindows()
{
    QWidget *window;
    foreach(window, registeredWindows)
    {
        if (window->isVisible())
        {
            window->hide();
            collapsedWindows.append(window);
        }
    }
}