changed my mind, gonna implement the feed on qt instead of qml, first tries, nothing working yet

This commit is contained in:
Blue 2020-08-16 00:48:28 +03:00
parent 4e6bd04b02
commit e54cff0f0c
10 changed files with 200 additions and 100 deletions

View file

@ -7,7 +7,7 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
# Find the QtWidgets library
find_package(Qt5Widgets CONFIG REQUIRED COMPONENTS Widgets Quick Qml QuickControls2 Core)
find_package(Qt5Widgets CONFIG REQUIRED COMPONENTS Widgets Core)
add_subdirectory(vcard)
@ -26,7 +26,5 @@ add_library(squawkWidgets ${squawkWidgets_SRC})
# Use the Widgets module from Qt 5.
target_link_libraries(squawkWidgets vCardUI)
target_link_libraries(squawkWidgets Qt5::Widgets)
target_link_libraries(squawkWidgets Qt5::Qml)
target_link_libraries(squawkWidgets Qt5::QuickControls2)
qt5_use_modules(squawkWidgets Quick Qml QuickControls2 Core Widgets)
qt5_use_modules(squawkWidgets Core Widgets)

View file

@ -45,7 +45,7 @@ Conversation::Conversation(bool muc, Models::Account* acc, Models::Element* el,
filesLayout(0),
overlay(new QWidget()),
filesToAttach(),
feed(new QQuickView()),
feed(new FeedView()),
scroll(down),
manualSliderChange(false),
requestingHistory(false),
@ -54,13 +54,8 @@ Conversation::Conversation(bool muc, Models::Account* acc, Models::Element* el,
{
m_ui->setupUi(this);
feed->setColor(QWidget::palette().color(QPalette::Base));
feed->setInitialProperties({{"model", QVariant::fromValue(el->feed)}});
feed->setResizeMode(QQuickView::SizeRootObjectToView);
feed->setSource(QUrl("qrc:/qml/feed.qml"));
QWidget *container = QWidget::createWindowContainer(feed, this);
container->setAutoFillBackground(false);
m_ui->widget->layout()->addWidget(container);
feed->setModel(el->feed);
m_ui->widget->layout()->addWidget(feed);
connect(acc, &Models::Account::childChanged, this, &Conversation::onAccountChanged);

View file

@ -24,7 +24,6 @@
#include <QMap>
#include <QMimeData>
#include <QFileInfo>
#include <QQuickView>
#include "shared/message.h"
#include "order.h"
@ -34,6 +33,7 @@
#include "ui/utils/resizer.h"
#include "ui/utils/flowlayout.h"
#include "ui/utils/badge.h"
#include "ui/utils/feedview.h"
#include "shared/icons.h"
#include "shared/utils.h"
@ -146,7 +146,7 @@ protected:
FlowLayout* filesLayout;
QWidget* overlay;
W::Order<Badge*, Badge::Comparator> filesToAttach;
QQuickView* feed;
FeedView* feed;
Scroll scroll;
bool manualSliderChange;
bool requestingHistory;