Exemple #1
0
TabPreview::TabPreview(QupZilla* mainClass, QWidget* parent)
    : QFrame(parent)
    , p_QupZilla(mainClass)
    , m_pixmap(new QLabel)
    , m_title(new QLabel)
    , m_previewIndex(-1)
    , m_animationsEnabled(true)
{
    m_pixmap->setAlignment(Qt::AlignHCenter);
    m_title->setAlignment(Qt::AlignHCenter);
    m_title->setWordWrap(true);

    QVBoxLayout* layout = new QVBoxLayout(this);
    layout->addWidget(m_pixmap);
    layout->addWidget(m_title);
    layout->setMargin(0);
    layout->setAlignment(Qt::AlignCenter);
    setLayout(layout);

    setBackgroundRole(QPalette::ToolTipBase);
    setForegroundRole(QPalette::ToolTipText);

    setContentsMargins(5, 5, 5, 5);
    setMaximumWidth(250);
    setMaximumHeight(170);

    m_animation =  new QPropertyAnimation(this, "geometry", this);
    m_opacityEffect = new QGraphicsOpacityEffect(this);
    m_opacityAnimation = new QPropertyAnimation(m_opacityEffect, "opacity", this);

    setGraphicsEffect(m_opacityEffect);
    m_opacityEffect->setOpacity(0.0);
}
Exemple #2
0
void PsiTipLabel::init(const QString& text)
{
    setText(text);
    initUi();
    resize(sizeHint());
    qApp->installEventFilter(this);
    startHideTimer();
    setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, nullptr, this) / 255.0);
    setForegroundRole(QPalette::ToolTipText);
    setBackgroundRole(QPalette::ToolTipBase);
    setPalette(QToolTip::palette());

    enableColoring_ = PsiOptions::instance()->getOption("options.ui.look.colors.tooltip.enable").toBool();
    if(enableColoring_){
        QColor textColor(PsiOptions::instance()->getOption("options.ui.look.colors.tooltip.text").toString());
        QColor baseColor(PsiOptions::instance()->getOption("options.ui.look.colors.tooltip.background").toString());
        if(textColor.isValid() && baseColor.isValid() && textColor != baseColor) { //looks fine
            QPalette palette(QToolTip::palette());
            palette.setColor(QPalette::ToolTipText, textColor);
            palette.setColor(QPalette::ToolTipBase, baseColor);
            palette.setColor(QPalette::WindowText, textColor);
            palette.setColor(QPalette::Window, baseColor);
            setPalette(palette);
        } else {
            enableColoring_ = false;
        }
    }
    const QString css = PsiOptions::instance()->getOption("options.ui.contactlist.tooltip.css").toString();
    if (!css.isEmpty()) {
        setStyleSheet(css);
    }
}
Exemple #3
0
void DropArea::dragEnterEvent(QDragEnterEvent *event) {
    setBackgroundRole(QPalette::Highlight);
    setForegroundRole(QPalette::HighlightedText);

    event->acceptProposedAction();
    emit changed(event->mimeData());
}
DCursorTracker::DCursorTracker(const QString& txt, QWidget* const parent, Qt::Alignment align)
    : QLabel(txt, parent, Qt::ToolTip | Qt::BypassGraphicsProxyWidget), 
      d(new Private)
{
    setForegroundRole(QPalette::ToolTipText);
    setBackgroundRole(QPalette::ToolTipBase);
    setPalette(QToolTip::palette());
    ensurePolished();
    const int fwidth = 1 + style()->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, 0, this);
    setContentsMargins(fwidth, fwidth, fwidth, fwidth);
    setFrameStyle(QFrame::NoFrame);
    setAlignment(Qt::AlignLeft | Qt::AlignTop);
    setIndent(1);
    setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, 0, this) / 255.0);

    d->alignment = align;
    d->parent    = parent;
    d->parent->setMouseTracking(true);
    d->parent->installEventFilter(this);

    d->autoHideTimer = new QTimer(this);
    d->autoHideTimer->setSingleShot(true);

    connect(d->autoHideTimer, SIGNAL(timeout()),
            this, SLOT(slotAutoHide()));
}
Exemple #5
0
void DropArea::clear() {
    setText("<b>" + tr("Drop here to append to the playlist") + "</b>");
    setPixmap(QtIconLoader::icon("list-add").pixmap(24, 24));
    setBackgroundRole(QPalette::Base);
    setForegroundRole(QPalette::Text);

    emit changed();
}
Exemple #6
0
TextTip::TextTip(QWidget *parent) : QTipLabel(parent)
{
    setForegroundRole(QPalette::ToolTipText);
    setBackgroundRole(QPalette::ToolTipBase);
    ensurePolished();
    setMargin(1 + style()->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, 0, this));
    setFrameStyle(QFrame::NoFrame);
    setAlignment(Qt::AlignLeft);
    setIndent(1);
    setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, 0, this) / 255.0);
}
Exemple #7
0
void ShortcutKeyWidget::focusInEvent(QFocusEvent *) {
	setText(tr("Press Shortcut"));

	QPalette pal=parentWidget()->palette();
	pal.setColor(QPalette::Base, pal.color(QPalette::Base).dark(120));
	setPalette(pal);

	setForegroundRole(QPalette::Button);
	GlobalShortcutEngine::engine->resetMap();
	connect(GlobalShortcutEngine::engine, SIGNAL(buttonPressed(bool)), this, SLOT(updateKeys(bool)));
	installEventFilter(this);
}
void KexiLinkButton::init()
{
    setFlat(true);
    setText(QString());
    setCursor(QCursor(Qt::PointingHandCursor));
    setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    setForegroundRole(QPalette::Text);
    QStyleOptionButton option;
    option.initFrom(this);
    int m = style()->pixelMetric(QStyle::PM_ButtonMargin, &option, this);
    setFixedSize(iconSize() + QSize(m*2, m*2));
    d->origIcon = KIcon(icon());
}
Exemple #9
0
EnvelopeView::EnvelopeView(QWidget *parent, MessageView *messageView): QWidget(parent), m_messageView(messageView)
{
    // we create a dummy header, pass it through the style and the use it's color roles so we
    // know what headers in general look like in the system
    QHeaderView helpingHeader(Qt::Horizontal);
    helpingHeader.ensurePolished();

    setBackgroundRole(helpingHeader.backgroundRole());
    setForegroundRole(helpingHeader.foregroundRole());

    QVBoxLayout *lay = new QVBoxLayout(this);
    lay->setSpacing(0);
    lay->setContentsMargins(0, 0, 0, 0);
    setLayout(lay);

}
TipLabel::TipLabel(QWidget* parent)
    : SqueezeLabelV1(parent)
{
    setWindowFlags(Qt::ToolTip);
    setForegroundRole(QPalette::ToolTipText);
    setBackgroundRole(QPalette::ToolTipBase);
    setPalette(QToolTip::palette());
    ensurePolished();
    setFrameStyle(QFrame::NoFrame);
    setMargin(3);

    m_timer = new QTimer(this);
    m_timer->setSingleShot(true);
    m_timer->setInterval(500);
    connect(m_timer, SIGNAL(timeout()), this, SLOT(hide()));
}
Exemple #11
0
HelpPopup::HelpPopup(QWidget* parent) : QLabel(parent)
{
    setForegroundRole(QPalette::ToolTipText);
    setBackgroundRole(QPalette::ToolTipBase);
    setPalette(QToolTip::palette());
    ensurePolished();
    setMargin(1 + style()->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, 0, this));
    setFrameStyle(QFrame::NoFrame);
    setAlignment(Qt::AlignLeft);
    setIndent(1);
    setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, 0, this) / 255.0);
    setMouseTracking(true);

    setWindowFlags(Qt::Popup);
    setAttribute(Qt::WA_DeleteOnClose);

    QShortcut* shortcut = new QShortcut(QKeySequence("Esc"), this);
    connect(shortcut, SIGNAL(activated()), this, SLOT(close()));
}
Exemple #12
0
TabPreview::TabPreview(BrowserWindow* window, QWidget* parent)
    : QFrame(parent)
    , m_window(window)
    , m_previewIndex(-1)
    , m_animationsEnabled(true)
    , m_stepX(0)
    , m_stepY(0)
    , m_stepWidth(0)
    , m_stepHeight(0)
{
    m_pixmapLabel = new QLabel(this);
    m_pixmapLabel->setAlignment(Qt::AlignHCenter);

    m_title = new QLabel(this);
    m_title->setAlignment(Qt::AlignHCenter);
    m_title->setWordWrap(true);

    QVBoxLayout* layout = new QVBoxLayout(this);
    layout->addWidget(m_pixmapLabel);
    layout->addWidget(m_title);
    layout->setMargin(0);
    layout->setAlignment(Qt::AlignCenter);
    setLayout(layout);

    setBackgroundRole(QPalette::ToolTipBase);
    setForegroundRole(QPalette::ToolTipText);

    setContentsMargins(5, 5, 5, 5);
    setMaximumWidth(250);
    setMaximumHeight(170);

#ifdef ENABLE_OPACITY_EFFECT
    setGraphicsEffect(&m_opacityEffect);
    m_opacityEffect.setOpacity(0.0);
    connect(&m_opacityTimeLine, SIGNAL(frameChanged(int)), this, SLOT(setOpacity(int)));
#endif

    m_animation.setDuration(400);
    m_animation.setFrameRange(0, 100);
    m_animation.setUpdateInterval(20); // 50 fps
    connect(&m_animation, SIGNAL(frameChanged(int)), this, SLOT(setAnimationFrame(int)));
}
Exemple #13
0
void ImageNavigator::initialize() {
    setWindowFlags(Qt::Window | windowFlags());
    setAttribute(Qt::WA_DeleteOnClose);

    QRect screenRect = QApplication::desktop()->screenGeometry(QApplication::desktop()->primaryScreen());
    screenWidth = screenRect.width();
    screenHeight = screenRect.height();
    // qDebug() << "Screen Dimensions are " << screenWidth << " x " << screenHeight << endl;

    initializeTools();
    initializeActions();

    setBackgroundRole(QPalette::Dark);
    setForegroundRole(QPalette::Dark);
    navOrigin = QPoint(0, 0);
    scrollSpeed = 150;
    scrollBorder = 100;
    horizontalScrollBar()->setRange(0, 200);
    verticalScrollBar()->setRange(0, 200);
    horScroll = 0;
    verScroll = 0;
    imageScale = 1.0;
    //  maximumValueSearchRange=10;
    //  sigma = 3.0;
    //  maxSearchMethod = mrcImage::maximum_value;

    spotSelectMode = false;
    latticeRefinementMode = false;
    createPathMode = false;
    ctfView = false;
    viewDisplayParameters = false;
    fftSelectionMode = false;
    viewport()->setMouseTracking(true);
    connect(menu, SIGNAL(aboutToShow()), this, SLOT(openMenu()));

    if (imageType != "fft")
        image->setVisible("realOverlay", true);

    resize(1024, 768);
    showMaximized();
    //showFullScreen();
}
Exemple #14
0
DItemToolTip::DItemToolTip(QWidget* parent)
    : QLabel(parent, Qt::ToolTip), d(new DItemToolTipPriv)
{
    hide();

    setForegroundRole(QPalette::ToolTipText);
    setBackgroundRole(QPalette::ToolTipBase);
    setPalette(QToolTip::palette());
    ensurePolished();
    setMargin(qMax(d->tipBorder, 1 + style()->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, 0, this)));
    setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, 0, this) / 255.0);
    setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);

    setFrameStyle(QFrame::StyledPanel);
    /*
    Old-style box:
    setFrameStyle(QFrame::Plain | QFrame::Box);
    setLineWidth(1);
    */

    renderArrows();
}
Exemple #15
0
EnvelopeView::EnvelopeView(QWidget *parent, MessageView *messageView): QLabel(parent)
{
    // we create a dummy header, pass it through the style and the use it's color roles so we
    // know what headers in general look like in the system
    QHeaderView helpingHeader(Qt::Horizontal);
    helpingHeader.ensurePolished();

    setBackgroundRole(helpingHeader.backgroundRole());
    setForegroundRole(helpingHeader.foregroundRole());
    setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse);
    setIndent(5);
    setWordWrap(true);
    connect(this, SIGNAL(linkHovered(QString)), this, SLOT(onLinkHovered(QString)));

    QFontMetrics fm(font());
    int iconSize = fm.boundingRect(QLatin1Char('M')).height();
    contactKnownUrl = Gui::Util::resizedImageAsDataUrl(QLatin1String(":/icons/contact-known.png"), iconSize);
    contactUnknownUrl = Gui::Util::resizedImageAsDataUrl(QLatin1String(":/icons/contact-unknown.png"), iconSize);

    connect(this, SIGNAL(linkActivated(QString)), messageView, SLOT(headerLinkActivated(QString)));
    connect(this, SIGNAL(addressDetailsRequested(QString,QStringList&)),
            messageView, SIGNAL(addressDetailsRequested(QString,QStringList&)));
}