7 Info::Info(Book *book, QWidget *parent): QScrollArea(parent)
10 setProperty("FingerScrollable", true);
11 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
13 setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
15 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
16 setFrameStyle(QFrame::NoFrame);
18 QWidget *contents = new QWidget(this);
19 QVBoxLayout *layout = new QVBoxLayout(contents);
21 contents->setLayout(layout);
24 QLabel *title = new QLabel(book->title, contents);
25 layout->addWidget(title);
26 if (book->subject != "") {
27 QLabel *subject = new QLabel(book->subject, contents);
28 layout->addWidget(subject);
30 if (book->creators.size()) {
31 QLabel *creators = new QLabel(contents);
32 QString c = "By " + book->creators[0];
33 for (int i = 1; i < book->creators.size(); i++) {
34 c += ", " + book->creators[i];
37 layout->addWidget(creators);
39 QLabel *path = new QLabel("File: " + book->path(), contents);
40 layout->addWidget(path);
41 if (book->publisher != "") {
43 new QLabel("Published by " + book->publisher, contents);
44 layout->addWidget(publisher);
46 if (book->source != "") {
47 QLabel *source = new QLabel("Source: " + book->source, contents);
48 layout->addWidget(source);
50 if (book->rights != "") {
51 QLabel *rights = new QLabel(book->rights, contents);
52 layout->addWidget(rights);
59 setWidgetResizable(true);