Exemplo n.º 1
0
ShaderEffectItem::ShaderEffectItem(QDeclarativeItem *parent)
    : QDeclarativeItem(parent)
    , m_meshResolution(1, 1)
    , m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4)
    , m_blending(true)
    , m_program_dirty(true)
    , m_active(true)
    , m_respectsMatrix(false)
    , m_respectsOpacity(false)
    , m_checkedViewportUpdateMode(false)
    , m_checkedOpenGL(false)
    , m_checkedShaderPrograms(false)
    , m_hasShaderPrograms(false)
    , m_mirrored(false)
    , m_defaultVertexShader(true)
{
    setFlag(QGraphicsItem::ItemHasNoContents, false);
    connect(this, SIGNAL(visibleChanged()), this, SLOT(handleVisibilityChange()));
    m_active = isVisible();
}
void FieldBackendBase::endFieldUpdate()
{
    if (m_label.isCurrentValueDifferentFromStoredValue())
    {
        emit labelChanged();
    }

    if (m_enabled.isCurrentValueDifferentFromStoredValue())
    {
        emit enabledChanged();
    }

    if (m_visible.isCurrentValueDifferentFromStoredValue())
    {
        emit visibleChanged();
    }

    if (m_state.isCurrentValueDifferentFromStoredValue())
    {
        emit stateChanged();
    }

    m_statusMessages->endFieldUpdate();
}
Exemplo n.º 3
0
AsemanDevices::AsemanDevices(QObject *parent) :
    QObject(parent)
{
    p = new AsemanDevicesPrivate;
    p->hide_keyboard_timer = 0;
    p->keyboard_stt = false;

#ifdef Q_OS_ANDROID
    p->java_layer = AsemanJavaLayer::instance();

    connect( p->java_layer, SIGNAL(incomingShare(QString,QString)), SLOT(incoming_share(QString,QString)), Qt::QueuedConnection );
    connect( p->java_layer, SIGNAL(incomingImage(QString))        , SLOT(incoming_image(QString))        , Qt::QueuedConnection );
    connect( p->java_layer, SIGNAL(selectImageResult(QString))    , SLOT(select_image_result(QString))   , Qt::QueuedConnection );
    connect( p->java_layer, SIGNAL(activityPaused())              , SLOT(activity_paused())              , Qt::QueuedConnection );
    connect( p->java_layer, SIGNAL(activityResumed())             , SLOT(activity_resumed())             , Qt::QueuedConnection );
#endif

    connect( QGuiApplication::inputMethod(), SIGNAL(visibleChanged()), SLOT(keyboard_changed()) );
    connect( static_cast<QGuiApplication*>(QCoreApplication::instance())->clipboard(), SIGNAL(dataChanged()), SIGNAL(clipboardChanged()) );

    QScreen *scr = screen();
    if( scr )
        connect( scr, SIGNAL(geometryChanged(QRect)), SIGNAL(geometryChanged()) );
}
Exemplo n.º 4
0
ProgressItem::ProgressItem(QString message, bool isLoading, QGraphicsScene * scene) :
    message(message), isLoading(isLoading), scene(scene), progress(0)
{
    // CHECK FIXME Gideon
    // items = new QGraphicsItemGroup(0,scene);
    items = new QGraphicsItemGroup(0);
    connect(this, SIGNAL(visibleChanged()), SLOT(visiblityChanged()));

    // Spinner
    spinner = new SpinnerItem(80, 10, QColor(255,153,0));
    this->connect(spinner->timer, SIGNAL(timeout()), this, SLOT(applyProgress()));
    int spinnerX = (scene->width() * 0.5) - (spinner->boundingRect().width() * 0.5);
    int spinnerY = (scene->height() * 0.5) - (spinner->boundingRect().height() * 0.5);
    spinner->setPos( spinnerX, spinnerY );
    items->addToGroup(spinner);

	items->setZValue(10000);
	this->setZValue(100000);

    isSmoothAnimation = false;

    this->setVisible(false);
	scene->addItem(this);
}
Exemplo n.º 5
0
void MacToolButton::setVisible(bool arg) {
        if (m_visible != arg) {
                m_visible = arg;
                emit visibleChanged(arg);
        }
}
//private
void PrivateQGraphicsObject::setMGObj(MapGraphicsObject * mgObj)
{
    _mgObj = mgObj;

    if (_mgObj == 0)
        return;

    //Connect signals/slots for all of the changes in the MapGraphicsObject that we must be able to handle
    connect(_mgObj,
            SIGNAL(enabledChanged()),
            this,
            SLOT(handleEnabledChanged()));
    connect(_mgObj,
            SIGNAL(opacityChanged()),
            this,
            SLOT(handleOpacityChanged()));
    connect(_mgObj,
            SIGNAL(parentChanged()),
            this,
            SLOT(handleParentChanged()));
    connect(_mgObj,
            SIGNAL(posChanged()),
            this,
            SLOT(handlePosChanged()));
    connect(_mgObj,
            SIGNAL(rotationChanged()),
            this,
            SLOT(handleRotationChanged()));
    connect(_mgObj,
            SIGNAL(visibleChanged()),
            this,
            SLOT(handleVisibleChanged()));
    connect(_mgObj,
            SIGNAL(zValueChanged()),
            this,
            SLOT(handleZValueChanged()));
    connect(_mgObj,
            SIGNAL(selectedChanged()),
            this,
            SLOT(handleMGSelectedChanged()));
    connect(_mgObj,
            SIGNAL(flagsChanged()),
            this,
            SLOT(handleMGFlagsChanged()));
    connect(_mgObj,
            SIGNAL(keyFocusRequested()),
            this,
            SLOT(handleKeyFocusRequested()));
    connect(_mgObj,
            SIGNAL(redrawRequested()),
            this,
            SLOT(handleRedrawRequested()));

    //Get all of the info about the MGObject
    this->updateAllFromMG();

    connect(mgObj,
            SIGNAL(destroyed()),
            this,
            SLOT(deleteLater()));
}
Exemplo n.º 7
0
/*!
    \internal
*/
void QDeclarativePaintedItem::init()
{
    connect(this,SIGNAL(widthChanged()),this,SLOT(clearCache()));
    connect(this,SIGNAL(heightChanged()),this,SLOT(clearCache()));
    connect(this,SIGNAL(visibleChanged()),this,SLOT(clearCache()));
}
void AutoHideBehavior::hidePanel()
{
    m_visible = false;
    Q_EMIT visibleChanged(m_visible);
    createEdgeHitDetector();
}
Exemplo n.º 9
0
void WebBrowser::onStopLogin()
{
    setUrl(QUrl("about:blank"));
    emit visibleChanged(m_visible = false);
}
Exemplo n.º 10
0
QtWebPageEventHandler::~QtWebPageEventHandler()
{
    disconnect(qApp->inputPanel(), SIGNAL(visibleChanged()), this, SLOT(inputPanelVisibleChanged()));
}
Exemplo n.º 11
0
void AnimatedClearButton::setShallBeShown(bool shown)
{
    d->controller()->setShallBeShownDirectly(shown);
    visibleChanged();
}
Exemplo n.º 12
0
void AxesWindow::on_YVisibleCheck_clicked(bool checked)
{
	visibleChanged(1, checked);
}
Exemplo n.º 13
0
void ItemVisibilityControllerPropertyObject::setVisible(bool visible)
{
    m_visible = visible;
    visibleChanged();
}
Exemplo n.º 14
0
void StelDialog::setVisible(bool v)
{
	if (v)
	{
		QSize screenSize = StelMainView::getInstance().size();
		if (dialog)
		{
			dialog->show();
			StelMainView::getInstance().scene()->setActiveWindow(proxy);
			// If the main window has been resized, it is possible the dialog
			// will be off screen.  Check for this and move it to a visible
			// position if necessary
			QPointF newPos = proxy->pos();
			if (newPos.x()>=screenSize.width())
				newPos.setX(screenSize.width() - dialog->size().width());
			if (newPos.y()>=screenSize.height())
				newPos.setY(screenSize.height() - dialog->size().height());
			if (newPos != dialog->pos())
				proxy->setPos(newPos);

			proxy->setFocus();
			return;
		}

		QGraphicsWidget* parent = qobject_cast<QGraphicsWidget*>(this->parent());
		dialog = new QDialog(NULL);
		// dialog->setParent(parent);
		StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
		Q_ASSERT(gui);
		//dialog->setAttribute(Qt::WA_OpaquePaintEvent, true);
		connect(dialog, SIGNAL(rejected()), this, SLOT(close()));
		createDialogContent();
		dialog->setStyleSheet(gui->getStelStyle().qtStyleSheet);

		proxy = new CustomProxy(parent, Qt::Tool);
		proxy->setWidget(dialog);
		QSizeF size = proxy->size();

		// centre with dialog according to current window size.
		int newX = (int)((screenSize.width() - size.width())/2);
		int newY = (int)((screenSize.height() - size.height())/2);
		// Make sure that the window's title bar is accessible
		if (newY <-0)
			newY = 0;
		proxy->setPos(newX, newY);
		proxy->setWindowFrameMargins(2,0,2,2);
		// (this also changes the bounding rectangle size)

		// The caching is buggy on all plateforms with Qt 4.5.2
		proxy->setCacheMode(QGraphicsItem::ItemCoordinateCache);

		proxy->setZValue(100);
		StelMainView::getInstance().scene()->setActiveWindow(proxy);
		proxy->setFocus();
	}
	else
	{
		dialog->hide();
		emit visibleChanged(false);
		//proxy->clearFocus();
		StelMainView::getInstance().focusSky();
	}
}
void WebApplicationWindow::onVisibleChanged(bool visible)
{
    qDebug() << __PRETTY_FUNCTION__ << visible;

    emit visibleChanged();
}
MDeclarativeStatusBar::MDeclarativeStatusBar(QDeclarativeItem *parent) :
    QDeclarativeItem(parent),
    updatesEnabled(true),
    mousePressed(false),
    feedbackDelay(false),
    swipeGesture(false),
    sharedPixmapHandle(0),
    pixmapDamage(0),
    mOrientation(MDeclarativeScreen::Portrait),
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
     updateSharedTexture(false),
#endif
    feedbackPlayer(new FeedbackPlayer(this))
{
    setFlag(QGraphicsItem::ItemHasNoContents, false);
    setAcceptedMouseButtons(Qt::LeftButton);
    // higher than TitleBar
    setZValue(1010);
    setImplicitHeight(STATUSBAR_HEIGHT);

    if (!filterRegistered) {
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
        ::oldEventFilter = QCoreApplication::instance()->setEventFilter(x11EventFilter);
#else
        qApp->installNativeEventFilter(this);
#endif
#ifdef HAVE_XDAMAGE
        MDeclarativeScreen* screen = MDeclarativeScreen::instance();
        XDamageQueryExtension(screen->display(), &xDamageEventBase, &xDamageErrorBase);
#endif
        filterRegistered = true;
    }

#ifdef HAVE_DBUS
    if (QDBusConnection::sessionBus().interface()->isServiceRegistered(PIXMAP_PROVIDER_DBUS_SERVICE))
        isPixmapProviderOnline = true;
    else
#endif
        isPixmapProviderOnline = false;

#ifdef HAVE_DBUS
    dbusWatcher = new QDBusServiceWatcher( PIXMAP_PROVIDER_DBUS_SERVICE , QDBusConnection::sessionBus(),
                                           QDBusServiceWatcher::WatchForRegistration|QDBusServiceWatcher::WatchForUnregistration,
                                           this );

    connect(dbusWatcher, SIGNAL(serviceRegistered(QString)),
            this, SLOT(handlePixmapProviderOnline()));
    connect(dbusWatcher, SIGNAL(serviceUnregistered(QString)),
            this, SLOT(handlePixmapProviderOffline()));

#endif
    querySharedPixmapFromProvider();

    // XDamage event should come only when application is in foreground
#if defined USE_ABSTRACTION
    QmlWindowState * windowState = QmlWindowState::instance();
#else
    MWindowState * windowState = MWindowState::instance();
#endif
    connect(windowState, SIGNAL(activeChanged()), this, SLOT(updateXdamageEventSubscription()));
    connect(this, SIGNAL(visibleChanged()), this, SLOT(updateXdamageEventSubscription()));

    if (!feedbackPlayer->init("qt-components")) {
        delete feedbackPlayer;
        feedbackPlayer = 0;
    }
}
Exemplo n.º 17
0
void Text::dispatchEvents()
{
    int old_line = m_old_line + (m_old_start_index / m_width);
    int new_line = m_line + (m_start_index / m_width);
    if (old_line != new_line) {
        m_old_line = m_line;
        emit lineChanged();
    }

    if (m_latin != m_latin_old) {
        m_latin_old = m_latin;
        emit latinChanged();
    }

    if (m_old_start_index != m_start_index
            || m_text_dirty) {
        m_text_dirty = false;
        QString old_text = m_text;
        m_text = m_text_line->mid(m_start_index, m_end_index - m_start_index + 1);
        if (m_old_start_index != m_start_index) {
            m_old_start_index = m_start_index;
            emit indexChanged();
        }
        emit textChanged();
    }

    if (m_style_dirty) {
        m_style_dirty = false;

        bool emit_foreground = m_new_style.foreground != m_style.foreground;
        bool emit_background = m_new_style.background != m_style.background;
        TextStyle::Styles new_style = m_new_style.style;
        TextStyle::Styles old_style = m_style.style;

        bool emit_bold = false;
        bool emit_blink = false;
        bool emit_underline = false;
        bool emit_inverse = false;
        if (new_style != old_style) {
            emit_bold = differentStyle(new_style, old_style, TextStyle::Bold);
            emit_blink = differentStyle(new_style, old_style, TextStyle::Blinking);
            emit_underline = differentStyle(new_style, old_style, TextStyle::Underlined);
            emit_inverse = differentStyle(new_style, old_style, TextStyle::Inverse);
        }

        m_style = m_new_style;
        if (emit_inverse) {
            setForegroundColor();
            setBackgroundColor();
        } else {
            if (emit_foreground || emit_bold) {
                setForegroundColor();
            }
            if (emit_background) {
                setBackgroundColor();
            }
        }

        if (emit_bold) {
            emit boldChanged();
        }

        if (emit_blink) {
            emit blinkingChanged();
        }

        if (emit_underline) {
            emit underlineChanged();
        }

    }


    if (m_visible_old != m_visible) {
        m_visible_old = m_visible;
        emit visibleChanged();
    }
}
Exemplo n.º 18
0
void DailyProgressDialog::hideEvent(QHideEvent* event)
{
	emit visibleChanged(false);

	QDialog::hideEvent(event);
}
Exemplo n.º 19
0
void AnimatedClearButton::stayVisibleWhenAnimatedOut(bool stayVisible)
{
    d->stayAlwaysVisible = stayVisible;
    visibleChanged();
}
MTapStateMachine::MTapStateMachine(QObject *parent)
    :   QObject(parent),
        d_ptr(new MTapStateMachinePrivate)
{
    Q_D(MTapStateMachine);

    d->style = static_cast<const MTapStateMachineStyle *>(MTheme::style("MTapStateMachineStyle", ""));

    d->highlightMachine = new QStateMachine(this);

    d->unhighlightedState = new QState(d->highlightMachine);
    d->initialWaitState = new QState(d->highlightMachine);
    d->pressHighlightedState = new QState(d->highlightMachine);
    d->timedHighlightedState = new QState(d->highlightMachine);

    d->initialWaitTimer = new QTimer(this);
    d->initialWaitTimer->setSingleShot(true);
    d->initialWaitTimer->setInterval(d->style->initialWaitTime());

    d->minimumHighlightTimer = new QTimer(this);
    d->minimumHighlightTimer->setSingleShot(true);
    d->minimumHighlightTimer->setInterval(d->style->blinkDuration());

    d->highlightMachine->setInitialState(d->unhighlightedState);

    //Unhighlighted -> initialWaitState (on mouse press)
    d->initialMousePressTransition = new QEventTransition(parent, QEvent::GraphicsSceneMousePress);
    d->initialMousePressTransition->setTargetState(d->initialWaitState);
    d->unhighlightedState->addTransition(d->initialMousePressTransition);

    //InitialWaitState -> unhighlightedState (on Cancel Event)
    d->initCancelEventTransition = new MCancelEventTransition(parent);
    d->initCancelEventTransition->setTargetState(d->unhighlightedState);
    d->initialWaitState->addTransition(d->initCancelEventTransition);

    //InitialWaitState -> unhighlightedState (on visible changed)
    d->initVisibleChangedTransition = new QSignalTransition(parent, SIGNAL(visibleChanged()));
    d->initVisibleChangedTransition->setTargetState(d->unhighlightedState);
    d->initialWaitState->addTransition(d->initVisibleChangedTransition);

    //InitialWaitState -> timedHighlight (on mouse release)
    d->releaseTimedHighlightTransition = new QEventTransition(parent, QEvent::GraphicsSceneMouseRelease);
    d->releaseTimedHighlightTransition->setTargetState(d->timedHighlightedState);
    d->initialWaitState->addTransition(d->releaseTimedHighlightTransition);

    //InitialWaitState -> pressHighlightedState (on timer)
    d->timerHighlightTransition = new QSignalTransition(d->initialWaitTimer, SIGNAL(timeout()));
    d->timerHighlightTransition->setTargetState(d->pressHighlightedState);
    d->initialWaitState->addTransition(d->timerHighlightTransition);

    //PressHighlightedState -> unhighlightedState (on mouse release)
    d->releaseUnhighlightTransition = new QEventTransition(parent, QEvent::GraphicsSceneMouseRelease);
    d->releaseUnhighlightTransition->setTargetState(d->unhighlightedState);
    d->pressHighlightedState->addTransition(d->releaseUnhighlightTransition);

    //pressHighlightedState -> unhighlightedState (on Cancel Event)
    d->pressedCancelEventTransition = new MCancelEventTransition(parent);
    d->pressedCancelEventTransition->setTargetState(d->unhighlightedState);
    d->pressHighlightedState->addTransition(d->pressedCancelEventTransition);

    //pressHighlightedState -> unhighlightedState (on visible changed)
    d->pressedVisibleChangedTransition = new QSignalTransition(parent, SIGNAL(visibleChanged()));
    d->pressedVisibleChangedTransition->setTargetState(d->unhighlightedState);
    d->pressHighlightedState->addTransition(d->pressedVisibleChangedTransition);

    //TimedHighlightState -> UnhighlightedState (on timer)
    d->timerUnhighlightTransition = new QSignalTransition(d->minimumHighlightTimer, SIGNAL(timeout()));
    d->timerUnhighlightTransition->setTargetState(d->unhighlightedState);
    d->timedHighlightedState->addTransition(d->timerUnhighlightTransition);

    d->highlightMachine->start();

    connect(d->initialWaitState, SIGNAL(entered()), d->initialWaitTimer, SLOT(start()));
    connect(d->timedHighlightedState, SIGNAL(entered()), d->minimumHighlightTimer, SLOT(start()));
    connect(d->initialWaitState, SIGNAL(exited()), d->initialWaitTimer, SLOT(stop()));
    connect(d->timedHighlightedState, SIGNAL(exited()), d->minimumHighlightTimer, SLOT(stop()));

    connect(d->initCancelEventTransition, SIGNAL(triggered()), this, SIGNAL(release()));
    connect(d->initVisibleChangedTransition, SIGNAL(triggered()), this, SIGNAL(release()));
    connect(d->releaseUnhighlightTransition, SIGNAL(triggered()), this, SIGNAL(release()));
    connect(d->pressedCancelEventTransition, SIGNAL(triggered()), this, SIGNAL(release()));
    connect(d->pressedVisibleChangedTransition, SIGNAL(triggered()), this, SIGNAL(release()));
    connect(d->timerUnhighlightTransition, SIGNAL(triggered()), this, SIGNAL(release()));

    connect(d->pressHighlightedState, SIGNAL(entered()), this, SIGNAL(delayedPress()));
    connect(d->timedHighlightedState, SIGNAL(entered()), this, SIGNAL(delayedPress()));
}
Exemplo n.º 21
0
void Transcribe::guiReady(QObject* root) {
  m_main_window = qobject_cast<QWindow*>(root);
  m_text_area = m_main_window->findChild<QObject*>("text_area");

  // Set the icon, which, strangely enough, cannot be done from QML
  m_main_window->setIcon(QIcon("://window_icon"));

#ifndef Q_OS_ANDROID
  // Restore window state
  QSettings settings;
  settings.beginGroup(CFG_GROUP_SCREEN);
  if (settings.value(CFG_SCREEN_IS_MAXIMIZED, false).toBool()) {
    m_main_window->setVisibility(QWindow::Maximized);
  } else {
    m_main_window->resize(settings.value(CFG_SCREEN_SIZE,
                                         QSize(640, 480)).toSize());
    m_main_window->setPosition(settings.value(CFG_SCREEN_POS,
                                              QPoint(200, 200)).toPoint());
    settings.endGroup();\
  }
#endif

  // Install the key filter and connect its signals
  KeyCatcher* catcher = new KeyCatcher(root);
  connect(catcher,        SIGNAL(keyTyped()),
          &m_keeper,      SLOT(keyTyped()));
  connect(catcher,        SIGNAL(saveFile()),
          this,           SLOT(saveText()));
  connect(catcher,        SIGNAL(seekAudio(int)),
          m_player.get(), SLOT(skipSeconds(int)));
  connect(catcher,        SIGNAL(togglePlayPause()),
          m_player.get(), SLOT(togglePlayPause()));
  connect(catcher,        SIGNAL(togglePlayPause(bool)),
          m_player.get(), SLOT(togglePlayPause(bool)));
  connect(catcher,        SIGNAL(boost(bool)),
          m_player.get(), SLOT(boost(bool)));
  root->installEventFilter(catcher);
#ifdef Q_OS_ANDROID
  // On Android, we might connect the signals when using the virtual keyboard
  // in addition to the signals from the physical keyboard.
  connect(qApp->inputMethod(), SIGNAL(visibleChanged()),
          this,                SLOT(connectVirtualKeyboard()));
  connectVirtualKeyboard();
#endif

  // Connect GUI events to their callbacks
  connect(m_main_window,  SIGNAL(audioPositionChanged(int)),
          m_player.get(), SLOT(setPosition(int)));
  connect(m_main_window,  SIGNAL(playingStateChanged(bool)),
          m_player.get(), SLOT(togglePlayPause(bool)));
  connect(m_main_window,  SIGNAL(seekAudio(int)),
          m_player.get(), SLOT(skipSeconds(int)));
  connect(m_main_window,  SIGNAL(boostAudio(bool)),
          m_player.get(), SLOT(boost(bool)));
  connect(m_main_window, SIGNAL(saveText()),
          this,          SLOT(saveText()));
#ifdef Q_OS_ANDROID
  connect(m_main_window, SIGNAL(shareText()),
          this,          SLOT(shareText()));
  connect(m_main_window, SIGNAL(deleteText()),
          this,          SLOT(deleteText()));
#endif
  connect(m_main_window, SIGNAL(pickFiles()),
          this,          SLOT(pickFiles()));
  connect(m_main_window, SIGNAL(historySelected(int)),
          this,          SLOT(restoreHistory(int)));
  connect(m_main_window, SIGNAL(signalQuit()),
          this,          SLOT(close()));
  connect(m_main_window, SIGNAL(numWordsDirty()),
          this,          SLOT(countWords()));
}
Exemplo n.º 22
0
void WebBrowser::onStartLogin(const QUrl url)
{
    setUrl(url);
    m_visible = true;
    emit visibleChanged(m_visible);
}