feat: add maximum size of blog entry

This commit is contained in:
kuchy 2022-04-06 19:51:35 +02:00
parent c32650ed8c
commit 105587ed16
8 changed files with 56 additions and 18 deletions

View File

@ -36,7 +36,9 @@ public:
{
if (blogEntry->objectName().isEmpty())
blogEntry->setObjectName(QString::fromUtf8("blogEntry"));
blogEntry->resize(400, 300);
blogEntry->resize(250, 250);
blogEntry->setMinimumSize(QSize(0, 250));
blogEntry->setMaximumSize(QSize(16777215, 250));
formLayout = new QFormLayout(blogEntry);
formLayout->setObjectName(QString::fromUtf8("formLayout"));
lineEdit = new QLineEdit(blogEntry);

View File

@ -16,6 +16,7 @@
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QMenu>
#include <QtWidgets/QMenuBar>
#include <QtWidgets/QScrollArea>
#include <QtWidgets/QStatusBar>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QWidget>
@ -29,6 +30,9 @@ public:
QAction *actionExit;
QWidget *centralwidget;
QGridLayout *gridLayout;
QScrollArea *scrollArea;
QWidget *scrollAreaWidgetContents;
QGridLayout *gridLayout_2;
QVBoxLayout *blogsLayout;
QStatusBar *statusbar;
QMenuBar *menubar;
@ -48,10 +52,22 @@ public:
centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
gridLayout = new QGridLayout(centralwidget);
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
scrollArea = new QScrollArea(centralwidget);
scrollArea->setObjectName(QString::fromUtf8("scrollArea"));
scrollArea->setWidgetResizable(true);
scrollAreaWidgetContents = new QWidget();
scrollAreaWidgetContents->setObjectName(QString::fromUtf8("scrollAreaWidgetContents"));
scrollAreaWidgetContents->setGeometry(QRect(0, 0, 780, 539));
gridLayout_2 = new QGridLayout(scrollAreaWidgetContents);
gridLayout_2->setObjectName(QString::fromUtf8("gridLayout_2"));
blogsLayout = new QVBoxLayout();
blogsLayout->setObjectName(QString::fromUtf8("blogsLayout"));
gridLayout->addLayout(blogsLayout, 0, 0, 1, 1);
gridLayout_2->addLayout(blogsLayout, 0, 0, 1, 1);
scrollArea->setWidget(scrollAreaWidgetContents);
gridLayout->addWidget(scrollArea, 0, 0, 1, 1);
blogsView->setCentralWidget(centralwidget);
statusbar = new QStatusBar(blogsView);

View File

@ -6,10 +6,22 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<width>250</width>
<height>250</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>250</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>250</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>

View File

@ -56,10 +56,7 @@ void blogsView::displayBlogEntriesLoop(const QJsonArray &blogEntries)
for(int i = 0; i < blogEntries.size(); i++)
{
QJsonObject entry = (blogEntries.at(i)).toObject();
blogEntry *e = new blogEntry();
e -> setUserId(userId);
e -> setUpBlogEntryFromJson(entry);
ui -> blogsLayout -> addWidget(e);
createNewBlogEntry();
}
}
@ -70,15 +67,7 @@ void blogsView::displayBlogEntries()
qDebug() << blogId;
qDebug() << userBlog["blogId"].toString();
QJsonArray blogEntries = userBlog["items"].toArray();
qDebug() << blogEntries.size();
for(int i = 0; i < blogEntries.size(); i++)
{
QJsonObject entry = (blogEntries.at(i)).toObject();
blogEntry *e = new blogEntry();
e -> setUserId(userId);
e -> setUpBlogEntryFromJson(entry);
ui -> blogsLayout -> addWidget(e);
}
displayBlogEntriesLoop(blogEntries);
}

View File

@ -16,7 +16,26 @@
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="blogsLayout"/>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>780</width>
<height>539</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QVBoxLayout" name="blogsLayout"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>