commit 291250a59dfe65e698d7e7b66f2dcd5cdd26ff9d
parent 88ec11bb2086d6312eeb862265da3403881d35da
Author: MTRNord <mtrnord1@gmail.com>
Date: Sat, 21 Oct 2017 18:46:43 +0200
Fix Resize Bug and cleanup come more code
Signed-off-by: MTRNord <mtrnord1@gmail.com>
Diffstat:
7 files changed, 55 insertions(+), 32 deletions(-)
diff --git a/matrix/rooms.go b/matrix/rooms.go
@@ -153,8 +153,6 @@ func (r *Room) GetRoomAvatar() (avatarResp *gui.QPixmap, err error) {
avatar.LoadFromData(str, uint(len(str)), "", 0)
avatarResp = avatar
return
-
- return
}
func (r *Room) crawlRoomName() {
diff --git a/qml/ui/chat.ui b/qml/ui/chat.ui
@@ -2,6 +2,9 @@
<ui version="4.0">
<class>ChatWidget</class>
<widget class="QWidget" name="ChatWidget">
+ <property name="windowModality">
+ <enum>Qt::ApplicationModal</enum>
+ </property>
<property name="geometry">
<rect>
<x>0</x>
@@ -11,7 +14,7 @@
</rect>
</property>
<property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -639,6 +642,12 @@ border-radius: 5px;</string>
</property>
<item>
<widget class="QWidget" name="titleBar" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="minimumSize">
<size>
<width>0</width>
@@ -677,8 +686,17 @@ border-radius: 2px;</string>
</item>
<item row="0" column="1">
<layout class="QVBoxLayout" name="TitleLayout">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetDefaultConstraint</enum>
+ </property>
<item>
<widget class="QLabel" name="RoomTitle">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="minimumSize">
<size>
<width>0</width>
@@ -696,10 +714,25 @@ border-radius: 2px;</string>
<property name="text">
<string>Matrix HQ</string>
</property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ <property name="openExternalLinks">
+ <bool>false</bool>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
+ </property>
</widget>
</item>
<item>
<widget class="QLabel" name="Topic">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="minimumSize">
<size>
<width>0</width>
@@ -719,6 +752,9 @@ border-radius: 2px;</string>
<property name="textFormat">
<enum>Qt::AutoText</enum>
</property>
+ <property name="scaledContents">
+ <bool>false</bool>
+ </property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
@@ -728,6 +764,9 @@ border-radius: 2px;</string>
<property name="openExternalLinks">
<bool>true</bool>
</property>
+ <property name="textInteractionFlags">
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
+ </property>
</widget>
</item>
</layout>
@@ -851,7 +890,7 @@ border-radius: 2px;</string>
<x>0</x>
<y>0</y>
<width>601</width>
- <height>425</height>
+ <height>424</height>
</rect>
</property>
<property name="minimumSize">
diff --git a/ui/MainUI.go b/ui/MainUI.go
@@ -88,31 +88,17 @@ func (m *MainUI) NewUI() (err error) {
m.RoomTopic = widgets.NewQLabelFromPointer(m.widget.FindChild("Topic", core.Qt__FindChildrenRecursively).Pointer())
var layout = widgets.NewQHBoxLayout()
- layout.AddWidget(m.MainWidget, 1, core.Qt__AlignTop|core.Qt__AlignLeft)
- m.widget.SetLayout(layout)
+ m.window.SetLayout(layout)
+ layout.InsertWidget(0, m.MainWidget, 0, core.Qt__AlignTop|core.Qt__AlignLeft)
layout.SetSpacing(0)
layout.SetContentsMargins(0, 0, 0, 0)
- m.window.ConnectResizeEvent(func(event *gui.QResizeEvent) {
- m.widget.Resize(event.Size())
- event.Accept()
- })
-
m.widget.ConnectResizeEvent(func(event *gui.QResizeEvent) {
+ fmt.Println("resize Widget")
m.MainWidget.Resize(event.Size())
event.Accept()
})
- messageScrollArea.ConnectResizeEvent(func(event *gui.QResizeEvent) {
- messageScrollArea.Resize(event.Size())
- event.Accept()
- })
-
- roomScrollArea.ConnectResizeEvent(func(event *gui.QResizeEvent) {
- roomScrollArea.Resize(event.Size())
- event.Accept()
- })
-
//Set Avatar
avatarLogo := widgets.NewQLabelFromPointer(m.widget.FindChild("UserAvatar", core.Qt__FindChildrenRecursively).Pointer())
avatar, AvatarErr := matrix.GetOwnUserAvatar(m.cli)
@@ -165,6 +151,8 @@ func (m *MainUI) NewUI() (err error) {
})
m.startSync(m.MessageListLayout)
+ m.widget.SetSizePolicy2(widgets.QSizePolicy__Expanding, widgets.QSizePolicy__Expanding)
+ m.MainWidget.SetSizePolicy2(widgets.QSizePolicy__Expanding, widgets.QSizePolicy__Expanding)
roomListLayout.ConnectTriggerRoom(func(roomID string) {
room := m.rooms[roomID]
@@ -174,8 +162,6 @@ func (m *MainUI) NewUI() (err error) {
err = NewRoomErr
return
}
-
- m.widget.Resize(m.window.Size())
})
m.initRoomList(roomListLayout, roomScrollArea)
diff --git a/ui/moc.h b/ui/moc.h
@@ -8,10 +8,10 @@
#include <stdint.h>
#ifdef __cplusplus
-class QVBoxLayoutWithTriggerSlot;
-void QVBoxLayoutWithTriggerSlot_QVBoxLayoutWithTriggerSlot_QRegisterMetaTypes();
class QRoomVBoxLayoutWithTriggerSlot;
void QRoomVBoxLayoutWithTriggerSlot_QRoomVBoxLayoutWithTriggerSlot_QRegisterMetaTypes();
+class QVBoxLayoutWithTriggerSlot;
+void QVBoxLayoutWithTriggerSlot_QVBoxLayoutWithTriggerSlot_QRegisterMetaTypes();
extern "C" {
#endif
diff --git a/ui/moc_cgo_windows_windows_amd64.go b/ui/moc_cgo_windows_windows_amd64.go
@@ -1,8 +1,8 @@
package ui
/*
-#cgo CFLAGS: -fno-keep-inline-dllexport -march=nocona -mtune=core2 -pipe -O2 -Wextra -Wall -W -DUNICODE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN
-#cgo CXXFLAGS: -fno-keep-inline-dllexport -march=nocona -mtune=core2 -pipe -O2 -Wextra -Wall -W -fexceptions -mthreads -DUNICODE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN
+#cgo CFLAGS: -fno-keep-inline-dllexport -march=nocona -mtune=core2 -O2 -Wextra -Wall -W -DUNICODE -D_UNICODE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN
+#cgo CXXFLAGS: -fno-keep-inline-dllexport -march=nocona -mtune=core2 -O2 -Wextra -Wall -W -fexceptions -mthreads -DUNICODE -D_UNICODE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN
#cgo CXXFLAGS: -I../../Morpheus -I. -isystem C:/msys64/mingw64/include/QtWidgets -isystem C:/msys64/mingw64/include/QtGui -isystem C:/msys64/mingw64/include/QtCore -Irelease -IC:/msys64/mingw64/share/qt5/mkspecs/win32-g++
#cgo LDFLAGS: -Wl,-subsystem,windows -mthreads
#cgo LDFLAGS: -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -LC:/msys64/mingw64/lib -lqtmain -lshell32 -lQt5Widgets -lQt5Gui -lQt5Core
diff --git a/ui/moc_moc.h b/ui/moc_moc.h
@@ -1,7 +1,7 @@
/****************************************************************************
** Meta object code from reading C++ file 'moc.cpp'
**
-** Created by: The Qt Meta Object Compiler version 67 (Qt 5.9.1)
+** Created by: The Qt Meta Object Compiler version 67 (Qt 5.9.2)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
@@ -11,7 +11,7 @@
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'moc.cpp' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
-#error "This file was generated using the moc from 5.9.1. It"
+#error "This file was generated using the moc from 5.9.2. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
@@ -90,7 +90,7 @@ void *QRoomVBoxLayoutWithTriggerSlot::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QRoomVBoxLayoutWithTriggerSlot.stringdata0))
- return static_cast<void*>(const_cast< QRoomVBoxLayoutWithTriggerSlot*>(this));
+ return static_cast<void*>(this);
return QVBoxLayout::qt_metacast(_clname);
}
@@ -183,7 +183,7 @@ void *QVBoxLayoutWithTriggerSlot::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QVBoxLayoutWithTriggerSlot.stringdata0))
- return static_cast<void*>(const_cast< QVBoxLayoutWithTriggerSlot*>(this));
+ return static_cast<void*>(this);
return QVBoxLayout::qt_metacast(_clname);
}
diff --git a/ui/roomlist.go b/ui/roomlist.go
@@ -91,6 +91,7 @@ func (roomViewLayout *QRoomVBoxLayoutWithTriggerSlot) NewRoom(room *matrix.Room,
widgetScroll := mainUIStruct.MessageListLayout.ItemAt(i).Widget()
widgetScroll.DeleteLater()
}
+
return true
}
@@ -104,7 +105,6 @@ func (roomViewLayout *QRoomVBoxLayoutWithTriggerSlot) NewRoom(room *matrix.Room,
roomViewLayout.SetContentsMargins(0, 0, 0, 0)
wrapperWidget.InstallEventFilter(filterObject)
- widget.InstallEventFilter(filterObject)
roomViewLayout.InsertWidget(roomViewLayout.Count()+1, wrapperWidget, 0, 0)