コード例 #1
0
GenericChatroomWidget::GenericChatroomWidget(QWidget *parent)
    : QFrame(parent)
{
    setProperty("compact", Settings::getInstance().getCompactLayout());

    // avatar
    if (property("compact").toBool())
    {
        avatar = new MaskablePixmapWidget(this, QSize(20,20), ":/img/avatar_mask.svg");
    }
    else
    {
        avatar = new MaskablePixmapWidget(this, QSize(40,40), ":/img/avatar_mask.svg");
    }

    // status text
    statusMessageLabel = new CroppingLabel(this);
    statusMessageLabel->setObjectName("status");

    // name text
    nameLabel = new CroppingLabel(this);
    nameLabel->setObjectName("name");
    nameLabel->setTextFormat(Qt::PlainText);
    statusMessageLabel->setTextFormat(Qt::PlainText);

    onCompactChanged(property("compact").toBool());

    setProperty("active", false);
    setStyleSheet(Style::getStylesheet(":/ui/chatroomWidgets/genericChatroomWidget.css"));
}
コード例 #2
0
ファイル: categorywidget.cpp プロジェクト: apprb/qTox
CategoryWidget::CategoryWidget(QWidget* parent)
    : GenericChatItemWidget(parent)
{
    container = new QWidget(this);
    container->setObjectName("circleWidgetContainer");
    container->setLayoutDirection(Qt::LeftToRight);

    statusLabel = new QLabel(this);
    statusLabel->setObjectName("status");
    statusLabel->setTextFormat(Qt::PlainText);

    statusPic.setPixmap(QPixmap(":/ui/chatArea/scrollBarRightArrow.svg"));

    fullLayout = new QVBoxLayout(this);
    fullLayout->setSpacing(0);
    fullLayout->setMargin(0);
    fullLayout->addWidget(container);

    lineFrame = new QFrame(container);
    lineFrame->setObjectName("line");
    lineFrame->setFrameShape(QFrame::HLine);
    lineFrame->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
    lineFrame->resize(0, 0);

    listLayout = new FriendListLayout();
    listWidget = new QWidget(this);
    listWidget->setLayout(listLayout);
    fullLayout->addWidget(listWidget);

    setAcceptDrops(true);

    onCompactChanged(isCompact());

    setExpanded(true, false);
    updateStatus();
}