MCPcopy Create free account
hub / github.com/YACReader/yacreader / NoLibrariesWidget

Method NoLibrariesWidget

YACReaderLibrary/no_libraries_widget.cpp:8–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6#include <QVBoxLayout>
7
8NoLibrariesWidget::NoLibrariesWidget(QWidget *parent)
9 : QWidget(parent)
10{
11 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
12 setAutoFillBackground(true);
13
14 iconLabel = new QLabel();
15
16 lineLabel = new QLabel();
17
18 text = new QLabel(tr("You don't have any libraries yet"));
19 text->setStyleSheet("QLabel {font-size:25px;font-weight:bold;}");
20 textDescription = new QLabel(tr("<p>You can create a library in any folder, YACReaderLibrary will import all comics and folders from this folder. If you have created any library in the past you can open them.</p><p>Don't forget that you can use YACReader as a stand alone application for reading the comics on your computer.</p>"));
21 textDescription->setWordWrap(true);
22 textDescription->setMaximumWidth(330);
23
24 QPushButton *createButton = new QPushButton(tr("create your first library"));
25 createButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
26 QPushButton *addButton = new QPushButton(tr("add an existing one"));
27 addButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
28
29 auto layout = new QVBoxLayout(this);
30 auto buttonLayout = new QHBoxLayout();
31 auto topLayout = new QHBoxLayout();
32 auto textLayout = new QVBoxLayout();
33
34 QWidget *topWidget = new QWidget();
35 topWidget->setFixedWidth(650);
36 textLayout->addStretch();
37 textLayout->addWidget(text);
38 textLayout->addSpacing(12);
39 textLayout->addWidget(textDescription);
40 textLayout->addStretch();
41
42 topLayout->addStretch();
43 topLayout->addWidget(iconLabel, 0, Qt::AlignVCenter);
44 topLayout->addSpacing(30);
45 topLayout->addLayout(textLayout, 1);
46 topLayout->addStretch();
47 topLayout->setContentsMargins(0, 0, 0, 0);
48
49 topWidget->setLayout(topLayout);
50
51 layout->setAlignment(Qt::AlignHCenter);
52
53 buttonLayout->addSpacing(125);
54 buttonLayout->addWidget(createButton);
55 layout->addSpacing(25);
56 buttonLayout->addWidget(addButton);
57 buttonLayout->addSpacing(125);
58
59 layout->addStretch();
60 layout->addWidget(topWidget);
61 layout->addSpacing(20);
62 layout->addWidget(lineLabel, 0, Qt::AlignHCenter);
63 layout->addSpacing(10);
64 layout->addLayout(buttonLayout, 0);
65 layout->addSpacing(150);

Callers

nothing calls this directly

Calls 1

addSpacingMethod · 0.80

Tested by

no test coverage detected