Example #1
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);
}
Example #2
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();
}
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());
}
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
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));
}
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);
}
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);
}
Example #8
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 #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
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();
}
Example #11
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 #13
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 #14
0
Cover::Cover(QWidget *parent)
    : Label("", parent), d_ptr(new CoverPrivate(this))
{
    Q_D(Cover);

    QWidget::setAttribute(Qt::WA_TranslucentBackground, true);
    d->m_radius = 4;
    d->m_borderColor = QColor(0, 0, 0, 52);
    d->m_shadowColor = QColor(0, 0, 0, 26);

    QGraphicsDropShadowEffect *bodyShadow = new QGraphicsDropShadowEffect;
    bodyShadow->setBlurRadius(4.0);
    bodyShadow->setColor(d->m_shadowColor);
    bodyShadow->setOffset(2.0, 4.0);
    this->setGraphicsEffect(bodyShadow);

    connect(this, &Cover::shadowColorChanged, this, [ = ](QColor shadowColor) {
        bodyShadow->setColor(shadowColor);
    });
}
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();
}
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 #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
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 #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);
  }
}  
Example #20
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 #21
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);
}
Example #22
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();

}
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);
}
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 #25
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);
     }
 }
configGeneralSettings::configGeneralSettings(QWidget *parent, configcreator *config) :
    QWidget(parent),
    ui(new Ui::configGeneralSettings)
{
    ui->setupUi(this);
    conf = config;

    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);

    QFontDatabase::addApplicationFont("qrc:/fonts/Resources/fonts/Roboto-Bold.ttf");
    ui->windowLabel->setFont(QFont("Roboto",11));
    ui->simulationLabel->setFont(QFont("Roboto",11));
    ui->simDetailLabel->setFont(QFont("Roboto",9));
    ui->htlLabel->setFont(QFont("Roboto",11));
    ui->htlDetailLabel->setFont(QFont("Roboto",9));
    ui->gcsCommsLabel->setFont(QFont("Roboto",11));
    ui->gcsDetailLabel->setFont(QFont("Roboto",9));
    ui->dataLoggingLabel->setFont(QFont("Roboto",11));
    ui->dataDetailLabel->setFont(QFont("Roboto",9));

    connect(ui->simulationToggle,SIGNAL(valueChanged(int)),this,SLOT(toggleListener(int)));
    connect(ui->htlToggle,SIGNAL(valueChanged(int)),this,SLOT(toggleListener(int)));
    connect(ui->dataToggle,SIGNAL(valueChanged(int)),this,SLOT(toggleListener(int)));
    connect(ui->gcsToggle,SIGNAL(valueChanged(int)),this,SLOT(toggleListener(int)));
    connect(conf,SIGNAL(update()),this,SLOT(update()));

    if(conf->getValue("Vehicle ID") == ""){
        ui->simulationToggle->setEnabled(false);
        ui->htlToggle->setEnabled(false);
        ui->gcsToggle->setEnabled(false);
        ui->dataToggle->setEnabled(false);
    }
}
Example #29
0
void DropShadowWindow::changeTheme()
{
	if (m_BackgroundImageURL == NULL)
		return;

	switch (m_BackgroundMode)
	{
	case eBKMode::BKNOTILESTRETCH:
	{
		this->setStyleSheet(QString(css_bk_notilestretch).arg(m_BackgroundImageURL));

	} break;
	case eBKMode::BKSTRETCH:
	{
		this->setStyleSheet(QString(css_bk_stretch_round).arg(m_BackgroundImageURL));

	} break;
	case eBKMode::BKTILE:
	{
		this->setStyleSheet(QString(css_bk_tile).arg(m_BackgroundImageURL));

	} break;
	case eBKMode::CUSTOMSTRETCH:
	{ 
	} break;
	case eBKMode::CUSTOMTILE:
	{  
		QPalette *palette = new QPalette();
		palette->setBrush(QPalette::Background, QBrush(*m_BackgroundImage));
		setPalette(*palette);
	} break;
	default:
		break;
	}

	QGraphicsDropShadowEffect* effect = new QGraphicsDropShadowEffect();
	effect->setBlurRadius(SHADOW_WIDTH);
	effect->setOffset(0);
	effect->setColor(QColor(0, 0, 0));
	this->setGraphicsEffect(effect);
}
Example #30
0
/**
 * @brief FilterWidget::FilterWidget
 * @param parent
 */
FilterWidget::FilterWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::FilterWidget)
{
    ui->setupUi(this);
    ui->lineEdit->setShowMagnifier(true);
    ui->lineEdit->setType(MyLineEdit::TypeClear);
    ui->lineEdit->setAttribute(Qt::WA_MacShowFocusRect, false);

    m_list = new QListWidget();
    m_list->setWindowFlags(Qt::WindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint));
    m_list->setAttribute(Qt::WA_ShowWithoutActivating, true);
    m_list->setAttribute(Qt::WA_MacShowFocusRect, false);

    m_activeWidget = WidgetMovies;

    QPalette palette = m_list->palette();
    palette.setColor(QPalette::Highlight, palette.color(QPalette::Highlight));
    palette.setColor(QPalette::HighlightedText, palette.color(QPalette::HighlightedText));
    m_list->setPalette(palette);
    m_list->setStyleSheet(QString("background-color: #ffffff; border: 1px solid #f0f0f0; border-radius: 5px;"));
    m_list->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    m_list->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect(this);
    effect->setBlurRadius(16);
    effect->setOffset(0);
    effect->setColor(QColor(0, 0, 0, 100));
    m_list->setGraphicsEffect(effect);

    connect(ui->lineEdit, SIGNAL(textEdited(QString)), this, SLOT(onFilterTextChanged(QString)));
    connect(ui->lineEdit, SIGNAL(keyDown()), this, SLOT(onKeyDown()));
    connect(ui->lineEdit, SIGNAL(keyUp()), this, SLOT(onKeyUp()));
    connect(ui->lineEdit, SIGNAL(focusOut()), m_list, SLOT(hide()));
    connect(ui->lineEdit, SIGNAL(focusIn()), this, SLOT(setupFilters()));
    connect(ui->lineEdit, SIGNAL(returnPressed()), this, SLOT(addSelectedFilter()));
    connect(ui->lineEdit, SIGNAL(backspaceInFront()), this, SLOT(removeLastFilter()));
    connect(m_list, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(addFilterFromItem(QListWidgetItem*)));

    initFilters();
}