Example #1
0
SplashScreen::SplashScreen(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::SplashScreen)
{
    ui->setupUi(this);
    setWindowTitle("pi|game CREATOR");
    setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
    setAttribute(Qt::WA_TranslucentBackground);

    ssInitThread = new initThread();

    QGraphicsDropShadowEffect* ds = new QGraphicsDropShadowEffect;
    ds->setBlurRadius(4);
    ds->setXOffset(1);
    ds->setYOffset(1);
    ds->setColor(Qt::black);
    ui->splashLabel->setGraphicsEffect(ds);
    canClose = true;

    initThread* t = new initThread;
    t->splash = this;
    connect(t,SIGNAL(finished()), this, SLOT(initcomplete()));
    connect(t,SIGNAL(terminated()), this, SLOT(initcomplete()));
    connect(t,SIGNAL(messageChanged(QString)),this,SLOT(setMessage(QString)));
    t->start();
}
PreviewLabel::PreviewLabel(QWidget *parent)
    : QLabel(parent),
      m_dragging_left(false), m_dragging_right(false),
      m_dragging_top(false), m_dragging_bottom(false)

{
    m_zoom = 1;
    m_showBorders = false;
    m_left = 2;
    m_right = 2;
    m_top = 2;
    m_bottom = 2;
    setMouseTracking(true);
    setCursor(QCursor(Qt::ArrowCursor));
    m_hooverInfo = new QLabel(parentWidget());
    m_hooverInfo->hide();

    m_hooverInfo->setFrameShape(QFrame::StyledPanel);
    m_hooverInfo->setFrameShadow(QFrame::Sunken);

    QGraphicsDropShadowEffect *dropShadowEffect = new QGraphicsDropShadowEffect;
    dropShadowEffect->setBlurRadius(4);
    dropShadowEffect->setOffset(2, 2);
    m_hooverInfo->setGraphicsEffect(dropShadowEffect);
    m_hooverInfo->setAutoFillBackground(true);
    m_hooverInfo->raise();
}
void RoundItemButton::initUI() {
    m_itemIcon->setFocusPolicy(Qt::NoFocus);
    m_itemIcon->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);

    m_itemText->setWordWrap(true);
    m_itemText->setStyleSheet("color: rgba(255, 255, 255, 255);"
                              "font-size:16px; margin:0 5px;");
    m_itemText->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
    m_itemText->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->setMargin(0);
    mainLayout->addSpacing(10);
    mainLayout->addWidget(m_itemIcon);
    mainLayout->setAlignment(m_itemIcon, Qt::AlignHCenter);
    mainLayout->addWidget(m_itemText);

    setFocusPolicy(Qt::NoFocus);
    setFocusPolicy(Qt::StrongFocus);
    setLayout(mainLayout);
    setFixedSize(QSize(140, 140));
    setCheckable(true);

    QGraphicsDropShadowEffect *nameShadow = new QGraphicsDropShadowEffect(m_itemText);
    nameShadow->setBlurRadius(16);
    nameShadow->setColor(QColor(0, 0, 0, 85));
    nameShadow->setOffset(0, 4);
//    m_itemText->setGraphicsEffect(nameShadow);
}
void QtConfrenceVideoWindow::createLabels()
{
  if (_recordCtrlPanel) {
    //如果有录制控制面板,则使用其内部的文本框
    _textLabel = _recordCtrlPanel->GetStateLabel();
	} else {
    //否则创建一个
    _textLabel = new QLabel(this);
    if (_isLabelTransparent) {
      _textLabel->setWindowFlags(Qt::Window | Qt::FramelessWindowHint); // 实现背景透明必不可少
      _textLabel->setAutoFillBackground(false);
      _textLabel->setAttribute(Qt::WA_TranslucentBackground);
      _textLabel->setWordWrap(true);

      // 投影效果
      QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect(_textLabel);
      effect->setBlurRadius(0);
      effect->setColor(QColor("#0"));
      effect->setOffset(1,1);
      _textLabel->setGraphicsEffect(effect);
    } else {
      _textLabel->setAutoFillBackground(true);
    }
  }

  // 无视频信号文本
  _videoStatuslabel = new QLabel(this);
  _videoStatuslabel->setText(QString::fromLocal8Bit("无视频信号"));

  adjustLabelStyle();
}
Example #5
0
medAttachedPopup::medAttachedPopup(QWidget *parent)
    : QWidget(parent)
    , m_hostWidget(0)
    , m_gridLayout(new QGridLayout)
    , m_center(new QWidget(this))
    , m_arrow(new QPixmap(":arrow_bottom.png"))
    , m_arrowLabel(new QLabel(this))
    , m_orientation(BOTTOM)
{
    setWindowFlags(Qt::Popup|Qt::FramelessWindowHint);
    setAttribute(Qt::WA_TranslucentBackground, true);

    QGraphicsDropShadowEffect * effect = new QGraphicsDropShadowEffect;
    effect->setBlurRadius(10);
    effect->setOffset(1);
    effect->setColor(Qt::black);
    this->setGraphicsEffect(effect);

    m_gridLayout->setSpacing(0);
    m_gridLayout->setContentsMargins(effect->blurRadius(),effect->blurRadius(),
                                     effect->blurRadius(),effect->blurRadius());

    m_center->installEventFilter(this);
    m_center->setAttribute(Qt::WA_TranslucentBackground, false);
    m_center->setObjectName("centerWidget");
    m_center->setStyleSheet("#centerWidget {background-color:black; border:5px; border-radius:5px;}");
    setLayout(m_gridLayout.data());
    m_gridLayout->addWidget(m_center.data(), 1, 1, Qt::AlignCenter);

    placeArrow();
}
Example #6
0
void TnoteNameLabel::markText(const QColor& color) {
	QGraphicsDropShadowEffect *blur = new QGraphicsDropShadowEffect;
	blur->setColor(color);
	blur->setOffset(0.5, 0.5);
	blur->setBlurRadius(7.0);
	m_textItem->setGraphicsEffect(blur);
}
Example #7
0
ImagePreviewer::ImagePreviewer(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ImagePreviewer)
{
    cancelled = false;
    imagesCount = 0;
    multiMode = false;
    ui->setupUi(this);

    setWindowFlags(Qt::Window
                   | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint
                   | Qt::WindowMaximizeButtonHint
                   | Qt::WindowSystemMenuHint | Qt::WindowTitleHint);

    QtWin::extendFrameIntoClientArea(this);

    QGraphicsDropShadowEffect* ds = new QGraphicsDropShadowEffect;
    ds->setColor(Qt::white);
    ds->setOffset(0,0);
    ds->setBlurRadius(4);
    ui->loaderLabel->setGraphicsEffect(ds);
    ui->statusLabel->setGraphicsEffect(ds);
    QMovie* m = new QMovie(":/resources/RES/loader.gif");
    ui->loaderLabel->setMovie(m);
    m->setCacheMode(QMovie::CacheAll);
    m->start();
    imagePreview = new QGraphicsScene;
    ui->graphicsView->setScene(imagePreview);
    ui->graphicsView->setBackgroundBrush(QPixmap(":/resources/RES/alpha.png"));
    restoreGeometry(ideSettings::getByteArray(S_IMAGEPREVIEW_GEOMETRY));
}
PreviewLabel::PreviewLabel(QWidget *parent)
    : QLabel(parent),
      m_dragging_left(false), m_dragging_right(false),
      m_dragging_top(false), m_dragging_bottom(false)

{
    m_zoom = 1;
    m_showBorders = false;
    m_left = 2;
    m_right = 2;
    m_top = 2;
    m_bottom = 2;
    setMouseTracking(true);
    setCursor(QCursor(Qt::ArrowCursor));
    m_hooverInfo = new QLabel(parentWidget());
    m_hooverInfo->hide();

    m_hooverInfo->setFrameShape(QFrame::StyledPanel);
    m_hooverInfo->setFrameShadow(QFrame::Sunken);

    // TODO: The following code should be enabled for OSX
    // when QTBUG-23205 is fixed
    if (!Utils::HostOsInfo::isMacHost()) {
        QGraphicsDropShadowEffect *dropShadowEffect = new QGraphicsDropShadowEffect;
        dropShadowEffect->setBlurRadius(4);
        dropShadowEffect->setOffset(2, 2);
        m_hooverInfo->setGraphicsEffect(dropShadowEffect);
    }
    m_hooverInfo->setAutoFillBackground(true);
    m_hooverInfo->raise();
}
Example #9
0
SearchView::SearchView(QWidget *parent) : QWidget(parent)
{
    mItemIndex = -1;

    mScrollArea = new QScrollArea(this);
    mScrollArea->setStyleSheet("QScrollArea { background-color: transparent; border: none; }");

    mWidget = new QWidget(mScrollArea);
    mWidget->setStyleSheet("QWidget { background: transparent; } ");
    mScrollArea->setWidget(mWidget);

    ScrollBar *scrollBar = new ScrollBar();
    mScrollArea->setVerticalScrollBar(scrollBar);

    QGraphicsDropShadowEffect * e = new QGraphicsDropShadowEffect(this);
    e->setOffset(0, 10);
    e->setBlurRadius(30);
    e->setColor(QColor(0, 0, 0, .2 * 255));

    this->setGraphicsEffect(e);

    mServices.insert("Google", "https://google.com/search?q=%0");
    mServices.insert("Facebook", "https://www.facebook.com/search/results.php?q=%0");
    mServices.insert("Twitter", "https://twitter.com/search?q=%0");
    mServices.insert("Wikipedia", "https://wikipedia.org/w/index.php?search=%0");
    mServices.insert("Yelp", "http://www.yelp.com/search?find_desc=%0");

    connect(&mManager, SIGNAL(finished(QNetworkReply *)), this, SLOT(requestEnded(QNetworkReply *)));
}
Example #10
0
PlayMusicWindow::PlayMusicWindow(QWidget *parent, PlaylistHandler *plh, API *api, CoverHelper *coverHelper, QMainWindow* mainWindow, Player *player) :
    QMainWindow(parent),
    ui(new Ui::PlayMusicWindow)
{
    timer = new QTimer(this);
    timer->setInterval(1000);
    timer->setSingleShot(true);
    currCurrentCover = "";
    nextCurrentCover = "";
    prevCurrentCover = "";
    connect(timer, SIGNAL(timeout()), this, SLOT(timerDone()));
    posSliderMoving = false;
    this->realMainWindow = mainWindow;
    this->plh = plh;
    this->api = api;
    this->player = player;
    this->apb = new AudioPlayerBridge(realMainWindow);
    this->coverHelper = coverHelper;
    int volume = player->getVolume();
    ui->setupUi(this);
    this->setWindowFlags(this->windowFlags() & ~(Qt::WindowFullscreenButtonHint));
    messageHandler = new MessageHandler(this);
    QRect geometry = QApplication::desktop()->screenGeometry();
    this->setGeometry((geometry.width() - this->width()) / 2, (geometry.height() - this->height()) / 2, this->width(), this->height());
    ui->sldVolume->setStyle(new MyVolumeStyle);
    ui->sldVolume->setValue(volume);
    ui->sldPosition->setStyle(new MyVolumeStyle);
    this->setAttribute(Qt::WA_QuitOnClose, false);
    this->setAttribute(Qt::WA_DeleteOnClose);
    this->setFixedSize(this->size());
    playlistsRefreshing = false;
    QWidget* shadowArray[] = {ui->lblPlayMusic, ui->lblPlayedPlaylist};
    int count = sizeof(shadowArray) / sizeof(QWidget*);
    for (int i = 0; i < count; i++) {
        QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect(shadowArray[i]);
        effect->setBlurRadius(1);
        effect->setColor(QColor("#bb6008"));
        effect->setOffset(0, 1);
        shadowArray[i]->setGraphicsEffect(effect);
    }

    QWidget* clickthruArray[] = {};
    count = sizeof(clickthruArray) / sizeof(QWidget*);
    for (int i = 0; i < count; i++) {
        clickthruArray[i]->setAttribute(Qt::WA_TransparentForMouseEvents);
    }
    connect(player, SIGNAL(playlistsChanged(std::vector<std::string>)), this, SLOT(playlistsChanged(std::vector<std::string>)));
    connect(player, SIGNAL(currentSongChanged()), this, SLOT(songsChanged()));
    connect(player, SIGNAL(songPositionChanged()), this, SLOT(onPositionChanged()));
    connect(player, SIGNAL(stateChanged()), this, SLOT(refreshPlayPause()));
    connect(coverHelper, SIGNAL(coverGotten(std::string)), this, SLOT(gotCover(std::string)), Qt::DirectConnection);
    connect(messageHandler, SIGNAL(addedMessage(Message*)), this, SLOT(addedMessage(Message*)));
    connect(messageHandler, SIGNAL(removedMessage(Message*)), this, SLOT(deletedMessage(Message*)));
    connect(player, SIGNAL(songFailed()), this, SLOT(songFailed()));
    playlistsChanged(plh->getPlaylists());
    songsChanged();
    refreshPlayPause();
    wasPlaying = player->isPlaying() || player->isPaused();
}
void UserButton::addTextShadow(bool isEffective) {
    QGraphicsDropShadowEffect *nameShadow = new QGraphicsDropShadowEffect;
    nameShadow->setBlurRadius(16);
    nameShadow->setColor(QColor(0, 0, 0, 85));
    nameShadow->setOffset(0, 4);
    nameShadow->setEnabled(isEffective);
    m_textLabel->setGraphicsEffect(nameShadow);
}
Example #12
0
void Slideshow::addShadowEffect(QGraphicsItem *item) const
{
	QGraphicsDropShadowEffect *shadow = new QGraphicsDropShadowEffect();

	shadow->setColor(Qt::black);
	shadow->setBlurRadius(5);
	shadow->setOffset(0, 0);
	item->setGraphicsEffect(shadow);
}
Example #13
0
UserMarkerItem::UserMarkerItem(int id, QGraphicsItem *parent)
	: QGraphicsItem(parent), m_id(id), _fadeout(0), m_showSubtext(false)
{
	setFlag(ItemIgnoresTransformations);
	_bgbrush.setStyle(Qt::SolidPattern);
	QGraphicsDropShadowEffect *shadow = new QGraphicsDropShadowEffect;
	shadow->setOffset(0);
	shadow->setBlurRadius(10);
	setGraphicsEffect(shadow);
	setZValue(9999);
}
FramelessWindow::FramelessWindow(QWidget *parent)
    : QWidget(parent),
      ui(new Ui::FramelessWindow),
      m_bMousePressed(false),
      m_bDragTop(false),
      m_bDragLeft(false),
      m_bDragRight(false),
      m_bDragBottom(false) {
  setWindowFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint);
  // append minimize button flag in case of windows,
  // for correct windows native handling of minimize function
#if defined(Q_OS_WIN)
  setWindowFlags(windowFlags() | Qt::WindowMinimizeButtonHint);
#endif
  setAttribute(Qt::WA_NoSystemBackground, true);
  setAttribute(Qt::WA_TranslucentBackground);

  ui->setupUi(this);
  ui->restoreButton->setVisible(false);

  // shadow under window title text
  QGraphicsDropShadowEffect *textShadow = new QGraphicsDropShadowEffect;
  textShadow->setBlurRadius(4.0);
  textShadow->setColor(QColor(0, 0, 0));
  textShadow->setOffset(0.0);
  ui->titleText->setGraphicsEffect(textShadow);

  // window shadow
  QGraphicsDropShadowEffect *windowShadow = new QGraphicsDropShadowEffect;
  windowShadow->setBlurRadius(9.0);
  windowShadow->setColor(palette().color(QPalette::Highlight));
  windowShadow->setOffset(0.0);
  ui->windowFrame->setGraphicsEffect(windowShadow);

  QObject::connect(qApp, &QGuiApplication::applicationStateChanged, this,
                   &FramelessWindow::on_applicationStateChanged);
  setMouseTracking(true);

  // important to watch mouse move from all child widgets
  QApplication::instance()->installEventFilter(this);
}
Example #15
0
void AbstractContent::setFxIndex(int index)
{
    if (m_fxIndex == index)
        return;
    m_fxIndex = index;
    // apply graphics effect
#if QT_VERSION >= 0x040600
    switch (m_fxIndex) {
        default:
            setGraphicsEffect(0);
            break;
        case 1: {
            QGraphicsDropShadowEffect * ds = new QGraphicsDropShadowEffect(this);
            ds->setColor(Qt::black);
            ds->setBlurRadius(7);
            ds->setOffset(1, 1);
            setGraphicsEffect(ds);
            } break;
        case 2: {
            QGraphicsDropShadowEffect * ds = new QGraphicsDropShadowEffect(this);
            ds->setColor(Qt::white);
            ds->setBlurRadius(7);
            ds->setOffset(1, 1);
            setGraphicsEffect(ds);
            } break;
        case 3: {
            QGraphicsBlurEffect * b = new QGraphicsBlurEffect(this);
            b->setBlurRadius(5);
            b->setBlurHints(QGraphicsBlurEffect::QualityHint);
            setGraphicsEffect(b);
            } break;
        case 4: {
            QGraphicsBlurEffect * b = new QGraphicsBlurEffect(this);
            b->setBlurRadius(16);
            b->setBlurHints(QGraphicsBlurEffect::QualityHint);
            setGraphicsEffect(b);
            } break;
    }
#endif
    emit fxIndexChanged();
}
Example #16
0
SourcePortItem::SourcePortItem(QString itemName, bool isInApp,
                               bool editOnStart, Application *app, BuilderItem *parent) : BuilderItem(parent)
{
    itemType = SourcePortItemType;
    this->itemName = itemName;
    portAvailable = false;
    errorState = false;

    sigHandler = new ItemSignalHandler((QGraphicsItem*)this,SourcePortItemType,nullptr);
    pressed = false;
    moved = false;
    this->nestedInApp = isInApp;
    this->parent = parent;
    this->app = app;

    QFontMetrics fontMetric(font);
    int textWidth = fontMetric.width(itemName);

    prepareGeometryChange();
    mainRect = QRectF(-((2*PORT_TEXT_WIDTH) + textWidth)/2,-16,(2*PORT_TEXT_WIDTH) + textWidth,32);
    boundingR = QRectF(mainRect);
    setToolTip(itemName);

    setFlag(ItemIsMovable,!isInApp);
    setFlag(ItemIsSelectable,true);
    setFlag(ItemSendsGeometryChanges,true);

    if(!isInApp){
        QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect();
        effect->setColor(QColor(80,80,80,80));
        effect->setBlurRadius(5);
        setGraphicsEffect(effect);
    }

    allowInputs = false;
    allowOutputs = true;

    lineEditWidget = new QGraphicsProxyWidget(this);
    QLineEdit *lineEdit = new QLineEdit();
    QObject::connect(lineEdit,SIGNAL(editingFinished()),signalHandler(),SLOT(onEditingFinished()));
    QObject::connect(lineEdit,SIGNAL(returnPressed()),signalHandler(),SLOT(onEditingFinished()));
    lineEdit->setText(itemName);
    lineEditWidget->setWidget(lineEdit);
    if(editOnStart){
        lineEditWidget->setVisible(true);
    }else{
        lineEditWidget->setVisible(false);
    }
    QRectF geo = lineEditWidget->geometry();
    geo.setWidth(textWidth);
    lineEditWidget->setGeometry(geo);
    lineEditWidget->setPos(-textWidth/2,-lineEditWidget->geometry().height()/2);
}
Example #17
0
IndicatorItem::IndicatorItem(const QPointF &start, const QPointF &real_finish, Player *player)
    :start(start), finish(start), real_finish(real_finish)
{
    QGraphicsDropShadowEffect *halo = new QGraphicsDropShadowEffect();
    halo->setOffset(0,0);
    halo->setBlurRadius(5);
    halo->setColor(Qt::white);

    //setGraphicsEffect(halo);
    color = Sanguosha->getKingdomColor(player->getKingdom());
    width = player->isLord() ? 4 : 3;
}
Example #18
0
//-----------------------------------------------------------------------------
// Function: BusInterfaceItem()
//-----------------------------------------------------------------------------
BusInterfaceItem::BusInterfaceItem(LibraryInterface* lh, QSharedPointer<Component> component,
                                   QSharedPointer<BusInterface> busIf,
                                   QGraphicsItem *parent)
    : HWConnectionEndpoint(parent, busIf == 0, QVector2D(1.0f, 0.0f)),
      lh_(lh),
	  nameLabel_("", this),
      busInterface_(),
      component_(component),
      oldColumn_(0),
      oldPos_(),
      oldInterfacePositions_(),
      offPageConnector_(0),
      portsCopied_(false)
{
    setType(ENDPOINT_TYPE_BUS);
    setTypeLocked(busIf != 0 && busIf->getInterfaceMode() != General::INTERFACE_MODE_COUNT);

    busInterface_ = busIf;
    int squareSize = GridSize;

    QPolygonF shape;
    shape << QPointF(-squareSize/2, squareSize / 2)
          << QPointF(-squareSize/2, -squareSize)
          << QPointF(squareSize/2, -squareSize)
          << QPointF(squareSize/2, squareSize / 2)
          << QPointF(0, squareSize);
    setPolygon(shape);
    
	QFont font = nameLabel_.font();
    font.setPointSize(8);
    nameLabel_.setFont(font);
    nameLabel_.setRotation(-rotation());
    nameLabel_.setFlag(ItemStacksBehindParent);
	
	QGraphicsDropShadowEffect *shadow = new QGraphicsDropShadowEffect;
    shadow->setXOffset(0);
    shadow->setYOffset(0);
    shadow->setBlurRadius(5);
	nameLabel_.setGraphicsEffect(shadow);

    setFlag(ItemIsMovable);
    setFlag(ItemIsSelectable);
    setFlag(ItemSendsGeometryChanges);
    setFlag(ItemSendsScenePositionChanges);

    // Create the off-page connector.
    offPageConnector_ = new OffPageConnectorItem(this);
    offPageConnector_->setPos(0.0, -GridSize * 3);
    offPageConnector_->setFlag(ItemStacksBehindParent);
    offPageConnector_->setVisible(false);

    updateInterface();
}
LinkGraphicsItem::LinkGraphicsItem(QPointF startPoint, QPointF endPoint, ivec3 color,
                                   QPointF startDir, QPointF endDir)
    : startPoint_(startPoint)
    , endPoint_(endPoint)
    , color_(color.r, color.g, color.b)
    , startDir_(startDir)
    , endDir_(endDir) {
    setZValue(LINKGRAPHICSITEM_DEPTH);
    QGraphicsDropShadowEffect* processorShadowEffect = new QGraphicsDropShadowEffect();
    processorShadowEffect->setOffset(3.0);
    processorShadowEffect->setBlurRadius(3.0);
    setGraphicsEffect(processorShadowEffect);
}
Example #20
0
void Item::perhapsCreateGlow(Qt::KeyboardModifiers m) {
  ASSERT(d);
  if (writable && shouldGlow()
      && (mode()->mode()==Mode::MoveResize || (m & Qt::ControlModifier))) {
    QGraphicsDropShadowEffect *eff = new QGraphicsDropShadowEffect;
    eff->setColor(QColor("#00ff33"));
    eff->setOffset(QPointF(0, 0));
    eff->setBlurRadius(6);
    setGraphicsEffect(eff);
    if (parent())
      parent()->setGlowItem(this);
  }
}  
Example #21
0
Speed::Speed(QWidget *parent): QWidget(parent)
{
	QHBoxLayout *layout = new QHBoxLayout();
	layout->setSpacing(0);
	layout->setMargin(0);
	
	setStyleSheet("padding: 0;");
	
		QVBoxLayout *contentLayout = new QVBoxLayout();
		contentLayout->setSpacing(2);
		contentLayout->setMargin(0);
		contentLayout->setContentsMargins(0, 2, 0, 0);
		
		QWidget *content = new QWidget();
		content->setLayout(contentLayout);
		content->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
			
			QStackedLayout *speedometerLayout = new QStackedLayout(contentLayout);
			speedometerLayout->setSpacing(2);
			speedometerLayout->setMargin(0);
			speedometerLayout->setContentsMargins(0, 2, 0, 0);
			speedometerLayout->setStackingMode(QStackedLayout::StackAll);
			
			speedometerNeedle = new RotatableImageView(":/resources/speedometer-needle_160x160.png");
			speedometerNeedle->rotate(-129);
			speedometerLayout->addWidget(speedometerNeedle);
			
			QLabel *speedometer = new QLabel();
			speedometer->setPixmap(QPixmap(":/resources/speedometer_160x160.png"));
			speedometer->setMargin(2);
			speedometerLayout->addWidget(speedometer);
			
			speedometerLabel = new QLabel("N/A");
			speedometerLabel->setAlignment(Qt::AlignCenter);
			speedometerLabel->setStyleSheet("font: 13pt; font-weight: bold;");
			contentLayout->addWidget(speedometerLabel);
		
		TitledBox *box = new TitledBox(tr("Speed"), content);
		layout->addWidget(box);
		
	QGraphicsDropShadowEffect *dropShadow = new QGraphicsDropShadowEffect();
	dropShadow->setBlurRadius(6);
	dropShadow->setColor(QColor(0, 0, 0));
	dropShadow->setOffset(0, 0);
	
	setGraphicsEffect(dropShadow);
	
	setLayout(layout);
}
Example #22
0
void StartGameDialog::loadChipImages()
{
    QSvgRenderer svgRenderer;
    svgRenderer.load(m_provider->currentTheme()->graphicsPath());

    QPixmap blackChip(QSize(46, 46));
    blackChip.fill(Qt::transparent);
    QPixmap whiteChip(QSize(46, 46));
    whiteChip.fill(Qt::transparent);

    QPainter *painter = new QPainter(&blackChip);
    QString prefix = Utils::chipPrefixToString(m_chipsPrefix);
    svgRenderer.render(painter, prefix + "_1");
    delete painter;

    painter = new QPainter(&whiteChip);
    // TODO: get 12 from some global constant that is shared with QML
    svgRenderer.render(painter, prefix + "_12");
    delete painter;

    ui->blackLabel->setPixmap(blackChip);
    ui->whiteLabel->setPixmap(whiteChip);

    QGraphicsDropShadowEffect *blackShadow = new QGraphicsDropShadowEffect(this);
    blackShadow->setBlurRadius(10.0);
    blackShadow->setColor(Qt::black);
    blackShadow->setOffset(0.0);

    QGraphicsDropShadowEffect *whiteShadow = new QGraphicsDropShadowEffect(this);
    whiteShadow->setBlurRadius(10.0);
    whiteShadow->setColor(Qt::black);
    whiteShadow->setOffset(0.0);

    ui->blackLabel->setGraphicsEffect(blackShadow);
    ui->whiteLabel->setGraphicsEffect(whiteShadow);
}
void EnemyEntity::draw(QPainter *painter)
{

    QGraphicsDropShadowEffect *shadow = new QGraphicsDropShadowEffect;
    int xOffset = (20.0f/(game->width()/2.0f)*x - 20);
    int yOffset = (20.0f/(game->height()/2.0f)*y - 20);

    shadow->setBlurRadius(8);
    shadow->setOffset(xOffset, yOffset);
    shadow->setColor(QColor(0,0,0,115));
    sprite->drawWithEffect(painter, getX()-20, getY()-20, shadow,20);

    //    Entity::draw(painter);
    painter->setPen(Qt::magenta);
    painter->drawRect(hitBox);
}
CurveGraphicsItem::CurveGraphicsItem(QPointF startPoint, QPointF endPoint, uvec3 color)
    : startPoint_(startPoint)
    , endPoint_(endPoint)
    , midPoint_(QPointF(0,0))
    , useMidPoint_(false)
    , color_(color.r, color.g, color.b)
    , borderColor_()
    , selectedBorderColor_() {

    setZValue(DRAGING_ITEM_DEPTH);
    QGraphicsDropShadowEffect* shadowEffect = new QGraphicsDropShadowEffect();
    shadowEffect->setOffset(3.0);
    shadowEffect->setBlurRadius(3.0);
    setGraphicsEffect(shadowEffect);
    resetBorderColors();
}
Example #25
0
void MenuBar::show()
{
    // Add shadow for better readability
    if (! Plasma::WindowEffects::isEffectAvailable(Plasma::WindowEffects::BlurBehind)) {
        QGraphicsDropShadowEffect *shadow = new QGraphicsDropShadowEffect();
        shadow->setBlurRadius(5);
        shadow->setOffset(QPointF(1, 1));
        shadow->setColor(Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor));
        setGraphicsEffect(shadow);
    } else {
        setGraphicsEffect(0);
    }
    m_hideTimer->start(1000);
    QGraphicsView::show();

}
Example #26
0
void Lighting::setupScene()
{
    m_scene.setSceneRect(-300, -200, 600, 460);

    QLinearGradient linearGrad(QPointF(-100, -100), QPointF(100, 100));
    linearGrad.setColorAt(0, QColor(255, 255, 255));
    linearGrad.setColorAt(1, QColor(192, 192, 255));
    setBackgroundBrush(linearGrad);

    QRadialGradient radialGrad(30, 30, 30);
    radialGrad.setColorAt(0, Qt::yellow);
    radialGrad.setColorAt(0.2, Qt::yellow);
    radialGrad.setColorAt(1, Qt::transparent);

    QPixmap pixmap(60, 60);
    pixmap.fill(Qt::transparent);

    QPainter painter(&pixmap);
    painter.setPen(Qt::NoPen);
    painter.setBrush(radialGrad);
    painter.drawEllipse(0, 0, 60, 60);
    painter.end();

    m_lightSource = m_scene.addPixmap(pixmap);
    m_lightSource->setZValue(2);

    for (int i = -2; i < 3; ++i)
        for (int j = -2; j < 3; ++j) {
            QAbstractGraphicsShapeItem *item;
            if ((i + j) & 1)
                item = new QGraphicsEllipseItem(0, 0, 50, 50);
            else
                item = new QGraphicsRectItem(0, 0, 50, 50);

            item->setPen(QPen(Qt::black, 1));
            item->setBrush(QBrush(Qt::white));
            QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect;
            effect->setBlurRadius(8);
            item->setGraphicsEffect(effect);
            item->setZValue(1);
            item->setPos(i * 80, j * 80);
            m_scene.addItem(item);
            m_items << item;
        }


}
DocsContentWindow::DocsContentWindow(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::DocsContentWindow)
{
    ui->setupUi(this);

    QGraphicsDropShadowEffect* shadow = new QGraphicsDropShadowEffect();
    shadow->setBlurRadius(6);
    shadow->setColor(QColor(0,0,0,200));
    shadow->setOffset(0);
    this->setGraphicsEffect(shadow);
    //
    QPalette pal = this->palette();
    pal.setColor(this->backgroundRole(), QColor(255,255,255));
    this->setPalette(pal);
    this->setAutoFillBackground(true);
}
Example #28
0
SystemInquiryDlg::SystemInquiryDlg(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::SystemInquiryDlg)
{
    ui->setupUi(this);
    setWindowTitle("\350\257\242\351\227\256");  /*询问*/
    setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
    setAttribute(Qt::WA_TranslucentBackground, true);

    QGraphicsDropShadowEffect *shadowEfct = new QGraphicsDropShadowEffect(this);
    shadowEfct->setBlurRadius(20.0);
    shadowEfct->setColor(QColor(0, 0, 0, 100));
    shadowEfct->setOffset(0, 0);
    setGraphicsEffect(shadowEfct);

    ui->okButton->setDefault(true);

}
void SceneWidgetContainer::setProxy(QGraphicsProxyWidget *child)
{
    childproxy = child;
    child->setFlag(ItemIsSelectable, false);
    QWidget *childwidget = child->widget();
    child->setParentItem(this);
    closepos = QPoint(childwidget->width(), -30);
    close.setParent(this);
    close.setPos((QPointF)closepos);

    setZValue(zValue()+0.5);
    setFlag(ItemIsMovable, true);
    QGraphicsDropShadowEffect drop;
    drop.setBlurRadius(10);
    drop.setOffset(5);
    drop.setColor(QColor(10, 10, 10, 200));
    setGraphicsEffect(&drop);
}
 void _ZFP_textShadowUpdate(ZF_IN const ZFUIColor &textShadowColor, ZF_IN const ZFUISize &textShadowOffset)
 {
     if(textShadowColor == ZFUIColorTransparent)
     {
         this->setGraphicsEffect(zfnull);
     }
     else
     {
         QGraphicsDropShadowEffect *effect = qobject_cast<QGraphicsDropShadowEffect *>(this->graphicsEffect());
         if(effect == zfnull)
         {
             effect = new QGraphicsDropShadowEffect(this);
             this->setGraphicsEffect(effect);
         }
         effect->setBlurRadius(0);
         effect->setColor(ZFImpl_sys_Qt_ZFUIKit_ZFUIColorToQColor(textShadowColor));
         effect->setOffset(textShadowOffset.width, textShadowOffset.height);
     }
 }