Exemplo n.º 1
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));
}
Exemplo n.º 2
0
KCMailSendingStatus::KCMailSendingStatus(QWidget *parent) :
    QWidget(parent)
{
    setContentsMargins(0,0,0,0);
    setAutoFillBackground(true);
    setMinimumHeight(50);

    QVBoxLayout *mainLayout=new QVBoxLayout(this);
    mainLayout->setContentsMargins(7,7,7,7);
    mainLayout->setSpacing(7);
    setLayout(mainLayout);

    reportStatus=new QLabel(this);
    reportStatus->setAlignment(Qt::AlignCenter);
    mainLayout->addWidget(reportStatus);
    mailProgress=new QProgressBar(this);
    mailProgress->setTextVisible(false);
    mainLayout->addWidget(mailProgress);

    QGraphicsDropShadowEffect *wndShadow = new QGraphicsDropShadowEffect(this);
    wndShadow->setBlurRadius(15.0);
    wndShadow->setColor(QColor(0, 0, 0, 200));
    wndShadow->setOffset(0);
    setGraphicsEffect(wndShadow);

    pal=mailProgress->palette();

    statusAnime=new QPropertyAnimation(this, "geometry", this);
    statusAnime->setEasingCurve(QEasingCurve::OutCubic);
}
Exemplo n.º 3
0
void Lighting::animate()
{
    angle += (M_PI / 30);
    qreal xs = 200 * sin(angle) - 40 + 25;
    qreal ys = 200 * cos(angle) - 40 + 25;
    m_lightSource->setPos(xs, ys);

    for (int i = 0; i < m_items.size(); ++i) {
        QGraphicsItem *item = m_items.at(i);
        Q_ASSERT(item);

        QGraphicsDropShadowEffect *effect = static_cast<QGraphicsDropShadowEffect *>(item->graphicsEffect());
        Q_ASSERT(effect);

        QPointF delta(item->x() - xs, item->y() - ys);
        effect->setOffset(delta.toPoint() / 30);

        qreal dx = delta.x();
        qreal dy = delta.y();
        qreal dd = sqrt(dx * dx + dy * dy);
        QColor color = effect->color();
        color.setAlphaF(qBound(0.4, 1 - dd / 200.0, 0.7));
        effect->setColor(color);
    }

    m_scene.update();
}
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();
}
Exemplo n.º 5
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 *)));
}
Exemplo n.º 6
0
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();
}
Exemplo n.º 7
0
CategorieButton::CategorieButton(QPixmap icon, QString name, QWidget *parent) : QWidget(parent) // This widget shows the icon and name of a menu's categorie
{
    resize(100, 100);
    isHovered = false;

    m_iconLabel = new QLabel(this);
    m_iconLabel->resize(size());
    m_iconLabel->setAlignment(Qt::AlignCenter);
    QPixmap modifiedIcon(48, 100);
    modifiedIcon.fill(Qt::transparent);
    QPainter p(&modifiedIcon);
    p.drawPixmap(0, 2, 48, 48, icon);
    QTransform t;
    p.drawPixmap(0, 50, 48, 48, icon.transformed(t.rotate(180, Qt::XAxis), Qt::SmoothTransformation));
    QLinearGradient alphaGradient(0, 0, 0, height());
    alphaGradient.setColorAt(0.0, Qt::black);
    alphaGradient.setColorAt(0.5, Qt::black);
    alphaGradient.setColorAt(0.8, Qt::transparent);
    QGraphicsOpacityEffect *iconEffect = new QGraphicsOpacityEffect(this);
    iconEffect->setOpacity(1);
    iconEffect->setOpacityMask(alphaGradient);
    m_iconLabel->setPixmap(modifiedIcon);
    m_iconLabel->setGraphicsEffect(iconEffect);

    m_nameLabel = new QLabel(name, this);
    m_nameLabel->setStyleSheet("color: white;");
    QGraphicsDropShadowEffect *nameEffect = new QGraphicsDropShadowEffect();
    nameEffect->setOffset(1);
    nameEffect->setColor(Qt::black);
    m_nameLabel->setGraphicsEffect(nameEffect);
    m_nameLabel->setAlignment(Qt::AlignCenter);
    m_nameLabel->setGeometry(0, 60, width(), m_nameLabel->height());
}
Exemplo n.º 8
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);
}
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();
}
Exemplo n.º 10
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();
}
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);
}
Exemplo n.º 12
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();
}
Exemplo n.º 13
0
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);
}
Exemplo n.º 14
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);
}
Exemplo n.º 15
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);
}
Exemplo n.º 17
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();
}
Exemplo n.º 18
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;
}
Exemplo n.º 19
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);
  }
}  
Exemplo n.º 20
0
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);
}
Exemplo n.º 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);
}
Exemplo n.º 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);
}
Exemplo n.º 24
0
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();
}
Exemplo n.º 25
0
SCgVisualControl::SCgVisualControl(QGraphicsScene *scene) :
    SCgVisualObject(scene),
    mDragLength(-1.f)
{
    mBackColor = scg_cfg_get_value_color(scg_key_control_backcolor_normal);
    mColor = scg_cfg_get_value_color(scg_key_control_color_normal);

#if ENABLE_VISUAL_EFFECTS_SUPPORT
    if (scg_cfg_get_value_uint(scg_key_effects_enabled) != 0)
    {
        QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect(this);
        effect->setOffset(3, 3);
        setGraphicsEffect(effect);
    }
#endif
}
Exemplo n.º 26
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();

}
Exemplo n.º 27
0
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);
}
Exemplo n.º 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);

}
Exemplo n.º 29
0
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);
     }
 }