Exemplo n.º 1
0
YaAbout::YaAbout()
	: YaWindow()
	, theme_(YaWindowTheme::Roster)
{
	ui_.setupUi(this);
	updateContentsMargins();
	instance_ = this;

	ui_.label->installEventFilter(this);

	QString osName;
#if defined(Q_WS_WIN)
	osName = "Windows";
#elif defined(Q_WS_MAC)
	osName = "Mac OS X";
#else
	osName = "Linux";
#endif
	ui_.appName->setText(ui_.appName->text().arg(osName));

	QString str = tr("%1 (Build %2)").arg(YAPSI_VERSION).arg(YAPSI_REVISION);
	ui_.buildLabel->setText(str);

	setMinimizeEnabled(false);
	setMaximizeEnabled(false);

	YaPushButton::initAllButtons(this);
}
void MToolBarLayoutPolicy::setCenterOffset(qreal offset)
{
    if (offset == centerOffset)
        return;

    centerOffset = offset;

    updateContentsMargins();
}
void MToolBarLayoutPolicy::updateSpacers()
{
    updateContentsMargins();

    if (centerAllWidgets
        || (centerLabelOnlyButtons && widgetCount() > 0 && labelOnlyButtonCount() == widgetCount())
        || (widgetCount() == 1 && labelOnlyButtonCount() == 1)) {
        activateLeftSpacer(true);
        activateRightSpacer(true);
        activateMiddleSpacers(false);

        return;
    }

    // Activate side spacer if there is just single widget in justified alignment
    // or alignment is neither to that direction nor justified.
    bool singleWidgetInJustified = (widgetCount() == 1 && isJustifiedAlignment());
    activateLeftSpacer(singleWidgetInJustified || !isAlignedLeftOrJustified());
    activateRightSpacer(singleWidgetInJustified || !isAlignedRightOrJustified());

    activateMiddleSpacers(spacesBetween);
}