Beispiel #1
0
ZoneViewWidget::ZoneViewWidget(Player *_player, CardZone *_origZone, int numberCards, bool _revealZone, const QList<ServerInfo_Card *> &cardList)
	: QGraphicsWidget(0, Qt::Tool | Qt::CustomizeWindowHint | Qt::WindowSystemMenuHint | Qt::WindowTitleHint/* | Qt::WindowCloseButtonHint*/), player(_player)
{
	setAttribute(Qt::WA_DeleteOnClose);
	setZValue(2000000006);
	
	QFont font;
	font.setPixelSize(10);
	setFont(font);

	QGraphicsLinearLayout *vbox = new QGraphicsLinearLayout(Qt::Vertical);
	
	if (numberCards < 0) {
		sortByNameCheckBox = new QCheckBox;
		QGraphicsProxyWidget *sortByNameProxy = new QGraphicsProxyWidget;
		sortByNameProxy->setWidget(sortByNameCheckBox);
		vbox->addItem(sortByNameProxy);

		sortByTypeCheckBox = new QCheckBox;
		QGraphicsProxyWidget *sortByTypeProxy = new QGraphicsProxyWidget;
		sortByTypeProxy->setWidget(sortByTypeCheckBox);
		vbox->addItem(sortByTypeProxy);
	} else {
		sortByNameCheckBox = 0;
		sortByTypeCheckBox = 0;
	}
	
	if (_origZone->getIsShufflable() && (numberCards == -1)) {
		shuffleCheckBox = new QCheckBox;
		shuffleCheckBox->setChecked(true);
		QGraphicsProxyWidget *shuffleProxy = new QGraphicsProxyWidget;
		shuffleProxy->setWidget(shuffleCheckBox);
		vbox->addItem(shuffleProxy);
	} else
		shuffleCheckBox = 0;
	
	extraHeight = vbox->sizeHint(Qt::PreferredSize).height();
	resize(150, 150);

	zone = new ZoneViewZone(player, _origZone, numberCards, _revealZone, this);
	connect(zone, SIGNAL(optimumRectChanged()), this, SLOT(resizeToZoneContents()));
	connect(zone, SIGNAL(beingDeleted()), this, SLOT(zoneDeleted()));
	vbox->addItem(zone);
	zone->initializeCards(cardList);
	
	if (sortByNameCheckBox) {
		connect(sortByNameCheckBox, SIGNAL(stateChanged(int)), zone, SLOT(setSortByName(int)));
		connect(sortByTypeCheckBox, SIGNAL(stateChanged(int)), zone, SLOT(setSortByType(int)));
		sortByNameCheckBox->setChecked(settingsCache->getZoneViewSortByName());
		sortByTypeCheckBox->setChecked(settingsCache->getZoneViewSortByType());
	}

	setLayout(vbox);
	retranslateUi();
}
GraphicsProxySimpleBrowser::GraphicsProxySimpleBrowser(QGraphicsItem *parent) :
    QGraphicsWidget(parent)
  , mGraphicsWebView(0)
{
    QWebSettings *gs = QWebSettings::globalSettings();
    gs->setAttribute(QWebSettings::JavaEnabled, true);
    gs->setAttribute(QWebSettings::PluginsEnabled, true);
    gs->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true);
    gs->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, true);
    gs->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);
    gs->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true);
    gs->setAttribute(QWebSettings::DnsPrefetchEnabled, true);

    setAutoFillBackground(true);

    mGraphicsWebView = new QGraphicsProxyWidget();
    mGraphicsWebView->setWidget(new SimpleBrowser());

    mLabel = new QLabel("QGraphicsProxyWidget");

    mCloseButton = new QToolButton();
    mCloseButton->setAutoRaise(true);
    mCloseButton->setText("X");

    QGraphicsLinearLayout *mainLayer = new QGraphicsLinearLayout(Qt::Vertical);

    QGraphicsLinearLayout *titleLayout = new QGraphicsLinearLayout(Qt::Horizontal);

    QGraphicsProxyWidget *proxyLabel = new QGraphicsProxyWidget();
    proxyLabel->setWidget(mLabel);

    QGraphicsProxyWidget *proxyCloseButton = new QGraphicsProxyWidget();
    proxyCloseButton->setWidget(mCloseButton);

    titleLayout->addItem(proxyLabel);
    titleLayout->addItem(proxyCloseButton);

    QGraphicsWidget *titleLayoutItem = new QGraphicsWidget();
    titleLayoutItem->setLayout(titleLayout);

    mainLayer->addItem(titleLayoutItem);
    mainLayer->addItem(mGraphicsWebView);

    setLayout(mainLayer);

    connect(mCloseButton, SIGNAL(clicked()), this, SLOT(on_mCloseButton_clicked()));

    setFlags(ItemIsMovable | ItemIsSelectable | ItemIsFocusable);

}
VideoViewAdapter::VideoViewAdapter()
: d(new VideoViewAdapterPrivate)
{
    d->q = this;
    d->mMediaObject = new Phonon::MediaObject(this);
    d->mMediaObject->setTickInterval(350);
    connect(d->mMediaObject, SIGNAL(finished()), SIGNAL(videoFinished()));

    d->mVideoWidget = new Phonon::VideoWidget;
    d->mVideoWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    d->mVideoWidget->setAttribute(Qt::WA_Hover);
    d->mVideoWidget->installEventFilter(this);

    Phonon::createPath(d->mMediaObject, d->mVideoWidget);

    d->mAudioOutput = new Phonon::AudioOutput(Phonon::VideoCategory, this);
    Phonon::createPath(d->mMediaObject, d->mAudioOutput);

    QGraphicsProxyWidget* proxy = new DoubleClickableProxyWidget;
    proxy->setFlag(QGraphicsItem::ItemIsSelectable); // Needed for doubleclick to work
    proxy->setWidget(d->mVideoWidget);
    setWidget(proxy);

    d->setupActions();
    d->setupHud(proxy);

    updatePlayUi();
    updateMuteAction();
}
Beispiel #4
0
WebPreviewItem::WebPreviewItem(const QUrl& url)
    : QGraphicsItem(nullptr)
    ,  // needs to be a top level item as we otherwise cannot guarantee that it's on top of other chatlines
    _boundingRect(0, 0, 400, 300)
{
    qreal frameWidth = 5;

    QGraphicsProxyWidget* proxyItem = new QGraphicsProxyWidget(this);
#    ifdef HAVE_WEBENGINE
    QWebEngineView* webView = new CustomWebView(proxyItem);
    webView->settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, false);
#    elif defined HAVE_WEBKIT
    QWebView* webView = new QWebView;
    webView->settings()->setAttribute(QWebSettings::JavascriptEnabled, false);
#    endif
    webView->load(url);
    webView->setDisabled(true);
    webView->resize(1000, 750);
    proxyItem->setWidget(webView);
    proxyItem->setAcceptHoverEvents(false);

    qreal xScale = (_boundingRect.width() - 2 * frameWidth) / webView->width();
    qreal yScale = (_boundingRect.height() - 2 * frameWidth) / webView->height();
    proxyItem->setTransform(QTransform::fromScale(xScale, yScale), true);
    proxyItem->setPos(frameWidth, frameWidth);

    setZValue(30);
}
Beispiel #5
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QWebView *web = new QWebView();
    web->load(QUrl("http://www.developpez.com"));
    web->show();

    QGraphicsScene scene;
    scene.setSceneRect(0 , 0, 1000, 800);

    QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget();
    proxy->setWidget(web);
    scene.addItem(proxy);

    QTransform matrix;
    matrix.rotate(45, Qt::YAxis);
    proxy->setTransform(matrix);

    QGraphicsView view(&scene);
    view.show();

    view.setWindowTitle("Ma premiere scene");
    return app.exec();
}
QGraphicsItem* GInteractiveObject::ProvideNewGraphicsItem(QGraphicsItem* pParentItem)
{
	QWidget* pWid = ProvideNewWidget(0);
	QGraphicsProxyWidget* pItem = new QGraphicsProxyWidget(pParentItem);
	pItem->setWidget(pWid);
	return pItem;
}
bool PluginView::platformStart()
{
    ASSERT(m_isStarted);
    ASSERT(m_status == PluginStatusLoadedSuccessfully);
    
    show();

    if (m_isWindowed) {
        QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient();
        QGraphicsProxyWidget* proxy = 0;
        if (QGraphicsWebView *webView = qobject_cast<QGraphicsWebView*>(client->pluginParent()))
            proxy = new QGraphicsProxyWidget(webView);

        PluginContainerSymbian* container = new PluginContainerSymbian(this, proxy ? 0 : client->ownerWidget(), proxy);
        setPlatformWidget(container);
        if (proxy)
            proxy->setWidget(container);
        
        m_npWindow.type = NPWindowTypeWindow;
        m_npWindow.window = (void*)platformPluginWidget();

    } else {
        setPlatformWidget(0);
        m_npWindow.type = NPWindowTypeDrawable;
        m_npWindow.window = 0; // Not used?
    }    
    updatePluginWidget();
    setNPWindowIfNeeded();

    if (qtwebkit_page_plugin_created)
        qtwebkit_page_plugin_created(QWebFramePrivate::kit(m_parentFrame.get()), m_instance, (void*)(m_plugin->pluginFuncs()));

    return true;
}
QAbstractAnimation *QSanRoomSkin::createHuaShenAnimation(QPixmap &huashenAvatar, QPoint topLeft, QGraphicsItem *parent,
    QGraphicsItem *&huashenAvatarCreated) const
{
    QLabel *avatar = new QLabel;
    avatar->setStyleSheet("QLabel { background-color: transparent; }");
    avatar->setPixmap(huashenAvatar);
    QGraphicsProxyWidget *widget = new QGraphicsProxyWidget(parent);
    widget->setWidget(avatar);
    widget->setPos(topLeft);

    QPropertyAnimation *animation = new QPropertyAnimation(widget, "opacity");
    animation->setLoopCount(2000);
    JsonArray huashenConfig = _m_animationConfig["huashen"].value<JsonArray>();
    int duration;
    if (tryParse(huashenConfig[0], duration) && huashenConfig[1].canConvert<JsonArray>()) {
        animation->setDuration(duration);
        JsonArray keyValues = huashenConfig[1].value<JsonArray>();
        for (int i = 0; i < keyValues.size(); i++) {
            QVariant keyValue = keyValues[i];
            if (!keyValue.canConvert<JsonArray>() || keyValue.value<JsonArray>().length() != 2) continue;
            double step;
            double val;
            JsonArray keyArr = keyValue.value<JsonArray>();
            if (!tryParse(keyArr[0], step) || !tryParse(keyArr[1], val)) continue;
            animation->setKeyValueAt(step, val);
        }
    }
    huashenAvatarCreated = widget;
    return animation;
}
Beispiel #9
0
 QGraphicsProxyWidget *UiHelper::CreateProxy(QWidget *widget)
 {
     cleanup_widgets_ << widget;
     QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(0, Qt::Widget);
     proxy->setWidget(widget);
     return proxy;
 }
void QtFallbackWebPopup::show(const QWebSelectData& data)
{
    if (!pageClient())
        return;

    destroyPopup();
    m_combo = new QtFallbackWebPopupCombo(*this);
    connect(m_combo, SIGNAL(activated(int)),
            SLOT(activeChanged(int)), Qt::QueuedConnection);

    populate(data);

    QRect rect = geometry();
#ifndef QT_NO_GRAPHICSVIEW
    if (QGraphicsWebView *webView = qobject_cast<QGraphicsWebView*>(pageClient()->pluginParent())) {
        QGraphicsProxyWidget* proxy = new QGraphicsProxyWidget(webView);
        proxy->setWidget(m_combo);
        proxy->setGeometry(rect);
    } else {
        m_combo->setParent(pageClient()->ownerWidget());
        m_combo->setGeometry(QRect(rect.left(), rect.top(),
                                   rect.width(), m_combo->sizeHint().height()));

    }
#else
    m_combo->setParent(pageClient()->ownerWidget());
    m_combo->setGeometry(QRect(rect.left(), rect.top(),
                               rect.width(), m_combo->sizeHint().height()));
#endif

    QMouseEvent event(QEvent::MouseButtonPress, QCursor::pos(), Qt::LeftButton,
                      Qt::LeftButton, Qt::NoModifier);
    QCoreApplication::sendEvent(m_combo, &event);
}
Beispiel #11
0
SEXP qt_qgraphicsProxyWidget(SEXP w)
{
    QGraphicsProxyWidget *pw = new QGraphicsProxyWidget(0, 0);
    pw->setWidget(unwrapQObject(w, QWidget));
    // return wrapQObject(pw);
    return wrapQGraphicsItem(pw);
}
Beispiel #12
0
AlbumsFilterBar::AlbumsFilterBar( QGraphicsItem *parent, Qt::WindowFlags wFlags )
    : QGraphicsWidget( parent, wFlags )
    , m_editor( new KLineEdit )
    , m_closeIcon( new Plasma::IconWidget( KIcon("dialog-close"), QString(), this ) )
{
    QGraphicsProxyWidget *editProxy = new QGraphicsProxyWidget( this );
    editProxy->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
    editProxy->setWidget( m_editor );

    m_editor->installEventFilter( this );
    m_editor->setAttribute( Qt::WA_NoSystemBackground );
    m_editor->setAutoFillBackground( true );
    m_editor->setClearButtonShown( true );
    m_editor->setClickMessage( i18n( "Filter Albums" ) );
    m_editor->setContentsMargins( 0, 0, 0, 0 );

    QSizeF iconSize = m_closeIcon->sizeFromIconSize( 16 );
    m_closeIcon->setMaximumSize( iconSize );
    m_closeIcon->setMinimumSize( iconSize );

    QGraphicsLinearLayout *layout = new QGraphicsLinearLayout( Qt::Horizontal, this );
    layout->setSpacing( 1 );
    layout->addItem( editProxy );
    layout->addItem( m_closeIcon );
    layout->setStretchFactor( editProxy, 100 );
    layout->setAlignment( editProxy, Qt::AlignCenter );
    layout->setAlignment( m_closeIcon, Qt::AlignCenter );
    layout->setContentsMargins( 0, 2, 0, 0 );

    m_closeIcon->setToolTip( i18n( "Close" ) );
    connect( m_closeIcon, SIGNAL(clicked()), SIGNAL(closeRequested()) );
    connect( m_editor, SIGNAL(textChanged(QString)), SIGNAL(filterTextChanged(QString)) );
}
Beispiel #13
0
DraggableItemBase::DraggableItemBase()
{
	m_draggableItemWidget = new DraggableItemWidget();
	QGraphicsProxyWidget* pProxyWidget = new QGraphicsProxyWidget(this);
	pProxyWidget->setWidget(m_draggableItemWidget);

	m_draggableItemWidget->setDraggableItemBase(this);
}
Beispiel #14
0
SublevelNodeItem::SublevelNodeItem(Node *node, QGraphicsItem *parent) :
    NodeItem(node, parent)
{
    m_sublevelNode = dynamic_cast<SublevelNode *>(node);
    m_rangeMeter = new RangeMeter();
    CHECKED_CONNECT(m_sublevelNode, SIGNAL(levelChanged(qreal)),
                    m_rangeMeter, SLOT(levelChanged(qreal)));
    QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(this);
    proxy->setWidget(m_rangeMeter);
    proxy->setPos(0, (m_node->getParams().size()+1)*guisettings->m_PIheight);
}
Beispiel #15
0
void GlMainView::updateShowOverviewButton() {
  if (_showOvButton == nullptr) {
    QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget();
    _showOvButton = new QPushButton();
    _showOvButton->setMaximumSize(10, 10);
    _showOvButton->setCheckable(true);
    _showOvButton->setStyleSheet("QPushButton {font-family: Arial; font-size: 10pt; border:none};");
    proxy->setWidget(_showOvButton);
    addToScene(proxy);
    proxy->setZValue(10);
    connect(_showOvButton, SIGNAL(toggled(bool)), this, SLOT(setOverviewVisible(bool)));
  }
Beispiel #16
0
QGraphicsProxyWidget *KGVisualItemGroup::createButton()
{
    QGraphicsProxyWidget *w = new QGraphicsProxyWidget;
    QToolButton *bt = new QToolButton();
    bt->setText("v/h");

    bt->setAttribute(Qt::WA_TranslucentBackground, true);
    w->setWidget(bt);
    bt->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
    connect(bt, SIGNAL(clicked()), this, SLOT(stickyStateChanged()));
    return w;
}
Beispiel #17
0
QGraphicsProxyWidget *
UpcomingEventsWidget::createLabel( const QString &text, QSizePolicy::Policy hPolicy )
{
    QLabel *label = new QLabel;
    label->setAttribute( Qt::WA_NoSystemBackground );
    label->setMinimumWidth( 10 );
    label->setSizePolicy( hPolicy, QSizePolicy::Preferred );
    label->setText( text );
    label->setWordWrap( false );
    QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget( this );
    proxy->setWidget( label );
    return proxy;
}
Beispiel #18
0
static QGraphicsProxyWidget *createItem(const QSizeF &minimum = QSizeF(100.0, 100.0),
                                   const QSizeF &preferred = QSize(150.0, 100.0),
                                   const QSizeF &maximum = QSizeF(200.0, 100.0),
                                   const QString &name = "0")
{
    QGraphicsProxyWidget *w = new QGraphicsProxyWidget;
    w->setWidget(new QPushButton(name));
    w->setData(0, name);
    w->setMinimumSize(minimum);
    w->setPreferredSize(preferred);
    w->setMaximumSize(maximum);

    w->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
    return w;
}
Beispiel #19
0
QProgressBar *Dashboard::addProgressBar(){
    QProgressBar *progress_bar = new QProgressBar;
    progress_bar->setMinimum(0);
    progress_bar->setMaximum(100);
    progress_bar->setFixedSize(300, 15);
    progress_bar->setTextVisible(false);

    QGraphicsProxyWidget *widget = new QGraphicsProxyWidget(right);
    widget->setWidget(progress_bar);
    widget->setParentItem(middle);
    widget->setPos(300, - 25);

    progress_bar->hide();

    return progress_bar;
}
Beispiel #20
0
Window::Window()
: QGraphicsWidget(0, Qt::Window)
{
    FlowLayout *lay = new FlowLayout;
    QLatin1String wiseWords("I am not bothered by the fact that I am unknown."
    " I am bothered when I do not know others. (Confucius)");
    QString sentence(wiseWords);
    QStringList words = sentence.split(QLatin1Char(' '), QString::SkipEmptyParts);
    for (int i = 0; i < words.count(); ++i) {
        QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(this);
        QLabel *label = new QLabel(words.at(i));
        label->setFrameStyle(QFrame::Box | QFrame::Plain);
        proxy->setWidget(label);
        lay->addItem(proxy);
    }
    setLayout(lay);
}
Beispiel #21
0
void ImageProxyItem::Private::onFinished(int /*id*/, QMovie * movie) {
    QLabel * label = new QLabel;
    label->setMovie(movie);
    movie->setParent(label);
    movie->start();
    label->resize(movie->frameRect().size());
    QGraphicsProxyWidget * item = new QGraphicsProxyWidget(this->owner);
    item->setWidget(label);
    // HACK workaround for https://bugreports.qt.io/browse/QTBUG-55070
    item->setOpacity(0.99);

    this->movie = movie;
    this->item = item;

    this->activity = Activity::Activated;

    emit this->owner->activated(this->owner);
}
void QtFallbackWebPopup::show(const QWebSelectData& data)
{
    if (!pageClient())
        return;

#if ENABLE(SYMBIAN_DIALOG_PROVIDERS)
    TRAP_IGNORE(showS60BrowserDialog());
#else

    destroyPopup();
    m_combo = new QtFallbackWebPopupCombo(*this);
    connect(m_combo, SIGNAL(activated(int)),
            SLOT(activeChanged(int)), Qt::QueuedConnection);

    populate(data);

    QColor backgroundColor = data.backgroundColor();
    QColor foregroundColor = data.foregroundColor();

    QPalette palette = m_combo->palette();
    if (backgroundColor.isValid())
        palette.setColor(QPalette::Background, backgroundColor);
    if (foregroundColor.isValid())
        palette.setColor(QPalette::Foreground, foregroundColor);
    m_combo->setPalette(palette);


    QRect rect = geometry();
    if (QGraphicsWebView *webView = qobject_cast<QGraphicsWebView*>(pageClient()->pluginParent())) {
        QGraphicsProxyWidget* proxy = new QGraphicsProxyWidget(webView);
        proxy->setWidget(m_combo);
        proxy->setGeometry(rect);
    } else {
        m_combo->setParent(pageClient()->ownerWidget());
        m_combo->setGeometry(QRect(rect.left(), rect.top(),
                               rect.width(), m_combo->sizeHint().height()));

    }

    QMouseEvent event(QEvent::MouseButtonPress, QCursor::pos(), Qt::LeftButton,
                      Qt::LeftButton, Qt::NoModifier);
    QCoreApplication::sendEvent(m_combo, &event);
#endif
}
MessageViewAdapter::MessageViewAdapter()
: d(new MessageViewAdapterPrivate)
{
    QWidget* widget = new QWidget;
    widget->installEventFilter(this);
    d->setupUi(widget);
    d->mMessageWidget->setCloseButtonVisible(false);
    d->mMessageWidget->setWordWrap(true);

    setInfoMessage(i18n("No document selected"));

    widget->setAutoFillBackground(true);
    widget->setBackgroundRole(QPalette::Base);
    widget->setForegroundRole(QPalette::Text);

    QGraphicsProxyWidget* proxy = new QGraphicsProxyWidget;
    proxy->setWidget(widget);
    setWidget(proxy);
}
Beispiel #24
0
WebPreviewItem::WebPreviewItem(const QString &url)
  : QGraphicsItem(0), // needs to be a top level item as we otherwise cannot guarantee that it's on top of other chatlines
    _boundingRect(0, 0, 400, 300)
{
  qreal frameWidth = 5;

  QWebView *webView = new QWebView;
  webView->load(url);
  webView->resize(1000, 750);
  QGraphicsProxyWidget *proxyItem = new QGraphicsProxyWidget(this);
  proxyItem->setWidget(webView);
  proxyItem->setAcceptHoverEvents(false);

  qreal xScale = (_boundingRect.width() - 2 * frameWidth) / webView->width();
  qreal yScale = (_boundingRect.height() - 2 * frameWidth) / webView->height();
  proxyItem->scale(xScale, yScale);
  proxyItem->setPos(frameWidth, frameWidth);

  setZValue(30);
}
Beispiel #25
0
void HomeScreen::initSprite()
{
	_sprite = new QGraphicsWidget();

	QGraphicsItem* item;
	QGraphicsSimpleTextItem* text;
	QGraphicsProxyWidget* proxy;
	QLabel* label;
	QFont font;

	item = new QGraphicsPixmapItem();
	item->setParentItem(_sprite);
	item->setPos((BACKGROUND_W - (400.0f / 0.75f)) * 0.5f, BACKGROUND_H - 400.0f);
	_avatar = static_cast<QGraphicsPixmapItem*>(item);

	item = new QGraphicsPixmapItem(LoaderThread::instance()->getCachedPixmap(IMAGE_TITLE));
	item->setParentItem(_sprite);
	item->setPos(232.0f, 128.0f);

	font = QFont("Arial");
	font.setPixelSize(12);
	font.setWeight(QFont::Normal);
	font.setStretch(80);

	text = new QGraphicsSimpleTextItem("http://conanchen.com/Kinetris");
	text->setBrush(QColor::fromRgb(0xFF, 0xFF, 0xFF));
	text->setFont(font);
	text->setParentItem(_sprite);
	text->setPos(248.0f, 264.0f - 3.0f);

	label = new QLabel();
	label->resize(784, 24);
	label->setStyleSheet("background-color: transparent; color: #FFFFFF;");
	label->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
	proxy = new QGraphicsProxyWidget();
	proxy->setParentItem(_sprite);
	proxy->setWidget(label);
	proxy->setPos(248.0f, 592.0f - 6.0f);
	_sprite_status = proxy;
	_status = label;
}
Beispiel #26
0
const void GSquare::createMySquare()
{
    // Window

    // Creer les bouttons + Case
    group_pions = new QButtonGroup(this);

    flag_opt = 1;
    displayOptionGame();
    for (int y = 0; y < nb_col; ++y)
    {
        for (int x = 0; x < nb_col; ++x)
        {
            // Creer la case
            if (x < nb_col - 1 && y < nb_col - 1)
            {
                QPixmap tmp_pix("case.png");
                QGraphicsPixmapItem *pix = new QGraphicsPixmapItem(tmp_pix, fond, scene);
                pix->setPos( 50 + x * 50, 50 + y * 50);
                pix->scale(1.1, 1.1);

				
			}

			// Creer le Bouton
			GCase *btn = new GCase(NULL, x, y);
			btn->setGeometry(25 + x * 50, 25 + y * 50, 50, 50);
			btn->setFlat(true);
			btn->setAutoFillBackground(false);
			btn->setTaken(false);

			group_pions->addButton(btn, x * 100 + y);
           
			QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(fond);
			proxy->setWidget(btn);
			proxy->setPalette(QPalette(QColor(0, 0, 0, 0)));
		}
	  }
	 QObject::connect(group_pions, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(button_released(QAbstractButton *)));
}
Beispiel #27
0
QGraphicsItem* Dial::graphicsItem()
{
    if (m_pDial == nullptr) {
        m_pDial = new QDial();
        QObject::connect(m_pDial, &QDial::valueChanged, [this](int pos) {
            onDialValueChanged(pos);
        });

        QRect r = m_pDial->geometry();
        r.setWidth(cDefaultSize);
        r.setHeight(cDefaultSize);
        m_pDial->setGeometry(r);
        m_pDial->setNotchesVisible(true);
        m_pDial->setWrapping(false);
        updateDialValues();
    }

    QGraphicsProxyWidget *pWidgetItem = new QGraphicsProxyWidget();
    pWidgetItem->setWidget(m_pDial);

    return pWidgetItem;
}
Beispiel #28
0
	// Move Action
	ThymioMoveAction::ThymioMoveAction( QGraphicsItem *parent ) :
		ThymioButton(false, 0.2, false, false, parent)
	{
		setData(0, "action");
		setData(1, "move");

		QTransform transMatrix(2.0,0.0,0.0,0.0,2.3,0.0,0.0,0.0,1.0);
				
		for(int i=0; i<2; i++)
		{
			QSlider *s = new QSlider(Qt::Vertical);
			s->setRange(-500,500);
			s->setStyleSheet("QSlider::groove:vertical { width: 14px; border: 2px solid #000000; "
							  "background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #00FF00, stop:0.25 #FFFF00, stop:0.5 #FF0000, stop:0.75 #FFFF00, stop:1 #00FF00 ); }"
						      "QSlider::handle:vertical { "
						      "background: #FFFFFF; "
						      "border: 2px solid #000000; height: 10px; width: 20px; margin: 0px 0; }");
			s->setSliderPosition(0);

			QGraphicsProxyWidget *w = new QGraphicsProxyWidget(this);
			w->setWidget(s);
			w->setPos(10+i*200, 15);
			w->setTransform(transMatrix);
			
			sliders.push_back(s);
			widgets.push_back(w);
			
			connect(s, SIGNAL(valueChanged(int)), this, SLOT(valueChangeDetected()));
			connect(s, SIGNAL(valueChanged(int)), this, SLOT(updateIRButton()));
		}		

		timer = new QTimeLine(2000);
		timer->setFrameRange(0, 100);
		timer->setCurveShape(QTimeLine::LinearCurve);
		animation = new QGraphicsItemAnimation(this);
		animation->setItem(thymioBody);
		animation->setTimeLine(timer);				
		thymioBody->setTransformOriginPoint(0,-14);//(pt[1]+pt[0]) == 0 ? 0 : (abs(pt[1])-abs(pt[0]))/(abs(pt[1])+abs(pt[0]))*22.2,-25);
	}
Beispiel #29
0
void MenuManager::init(MainWindow *window)
{
    this->window = window;

    // Create div:
//    this->createTicker();
//    this->createUpnDownButtons();
//    this->createBackButton();

    this->bar = new TestBar(QSize(0,0),this->window->scene,0,QColor(0,0,0,200));
    QPushButton *testbtn = new QPushButton();
    testbtn->setText("xxxxx");
    QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(this->bar);
    proxy->setWidget(testbtn);
    testbtn->setGeometry(10,10,50,50);

    // Create first level menu:
    QDomElement rootElement = this->contentsDoc->documentElement();
    this->createRootMenu(rootElement);

    // Create second level menus:
//    QDomNode level2MenuNode = rootElement.firstChild();
//    while (!level2MenuNode.isNull()){
//        QDomElement level2MenuElement = level2MenuNode.toElement();
//        this->createSubMenu(level2MenuElement);
//
//        // create leaf menu and example info:
//        QDomNode exampleNode = level2MenuElement.firstChild();
//        while (!exampleNode.isNull()){
//            QDomElement exampleElement = exampleNode.toElement();
//            this->readInfoAboutExample(exampleElement);
////            this->createLeafMenu(exampleElement);
//            exampleNode = exampleNode.nextSibling();
//        }
//
//        level2MenuNode = level2MenuNode.nextSibling();
//    }
}
Beispiel #30
0
	// Color Action
	ThymioColorAction::ThymioColorAction( QGraphicsItem *parent ) :
		ThymioButton(false, 1.0, true, false, parent)
	{
		setData(0, "action");
		setData(1, "color");

		QTransform transMatrix(1.0,0.0,0.0,0.0,2.0,0.0,0.0,0.0,1.0);
		QString sliderColor("FF0000");
		
		for(int i=0; i<3; i++)
		{
			if( i == 1 ) sliderColor="00FF00";
			else if( i == 2 ) sliderColor="0000FF";

			QSlider *s = new QSlider(Qt::Horizontal);
			s->setRange(0,32);
			s->setStyleSheet(QString("QSlider::groove:horizontal { height: 14px; border: 2px solid #000000; "
							  "background: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #000000, stop:1 #%0); }"
						      "QSlider::handle:horizontal { "
						      "background: #FFFFFF; "
						      "border: 5px solid #000000; width: 18px; margin: -2px 0; }").arg(sliderColor));
			s->setSliderPosition(0);

			QGraphicsProxyWidget *w = new QGraphicsProxyWidget(this);
			w->setWidget(s);
			w->setPos(27, 70+i*60);
			w->setTransform(transMatrix);
			
			
			sliders.push_back(s);
			widgets.push_back(w);
			
			connect(s, SIGNAL(valueChanged(int)), this, SLOT(valueChangeDetected()));
			connect(s, SIGNAL(valueChanged(int)), this, SLOT(updateIRButton()));
		}

	}