Unterstütze den Ausbau der fairapps.net Infrastruktur und Serviceangebote per Crowdfunding oder hilf mit Issues zu lösen!

Commit 409da8b1 authored by armin's avatar armin

Merge branch 'fixMenuWidth' into 'master'

Fix menu width

See merge request !211
parents 973d23dd 32dfe067
Pipeline #777 passed with stage
in 2 minutes and 41 seconds
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtGraphicalEffects 1.0
import "qrc:/qml/style"
StyledMenu{
......@@ -7,42 +7,48 @@ StyledMenu{
signal replyTo(string messageId)
signal blockUser()
signal reportContent()
implicitWidth: 110
implicitWidth: 50
//implicitWidth: 110
StyledMenuItem{
id: copyItem
text: qsTr("copy")
onPressed: {
Action {
text: qsTr("copy");
checkable: false;
onTriggered: {
rocketChatController.copyToClipboard(messageText.text)
}
}
StyledMenuItem{
id: reply
text: qsTr("reply")
onPressed: {
Action {
text: qsTr("reply");
checkable: false
onTriggered: {
replyTo(model.id);
}
background: Item{}
}
StyledMenuItem{
id: deleteMessage
text: qsTr("delete")
onPressed: {
Action {
text: qsTr("delete");
checkable: false
onTriggered: {
rocketChatController.deleteMessage(channelView.currentChannel,model.id)
}
}
StyledMenuItem{
id: blockUserItem
text: qsTr("blockUser")
onPressed: {
Action {
text: qsTr("blockUser");
checkable: false
onTriggered: {
textBackground.blockUser();
}
}
StyledMenuItem{
id: reportContent
text: qsTr("report abuse")
onPressed: {
Action {
text: qsTr("report abuse");
checkable: false
onTriggered: {
textBackground.reportContent();
}
}
delegate: StyledMenuItem{
}
}
......@@ -19,8 +19,8 @@
********************************************************************************************/
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick 2.12
import QtQuick.Controls 2.12
import "qrc:/qml/style"
import "qrc:/javascript/print.js" as Print
......@@ -63,11 +63,11 @@ Page {
lastMessage: model.lastMessageText
channelId: model.roomId
onPressAndHold: {
// if(model.type === "d"){
menu.x = mouseX
menu.y = mouseY
menu.open()
// }
}
onPressed: {
onClicked: {
roomSelector.channelChanged(model.roomId,model.name,model.readonly,model.username,model.type, model.avatarImg)
}
}
......@@ -78,7 +78,6 @@ Page {
id: bottomLine
width: roomSelector.width
height: 1
//color: "#dfdfdf"
color: Colors.separatorGrey
}
......@@ -98,8 +97,35 @@ Page {
StyledMenu{
id: menu
x: 50
Action{
text: {
if(!model.blocked){
qsTr("block")
}else{
qsTr("unblock")
}
}
checkable: false;
onTriggered: {
if(!model.blocked){
console.log("pressed "+model.roomId)
rocketChatController.blockUser(model.roomId)
}else{
rocketChatController.unBlockUser(model.roomId)
}
}
}
Action{
text: qsTr("leave room")
checkable: false;
onTriggered: {
rocketChatController.leaveChannel(model.roomId)
}
}
delegate: StyledMenuItem{
}
StyledMenuItem{
/*StyledMenuItem{
id: blockUser
visible: model.type === "d"
height: {
......@@ -110,21 +136,7 @@ Page {
}
}
onPressed: {
if(!model.blocked){
console.log("pressed "+model.roomId)
rocketChatController.blockUser(model.roomId)
}else{
rocketChatController.unBlockUser(model.roomId)
}
}
text: {
if(!model.blocked){
qsTr("block")
}else{
qsTr("unblock")
}
}
}
StyledMenuItem{
id:leaveChannel
......@@ -134,7 +146,7 @@ Page {
rocketChatController.leaveChannel(model.roomId)
}
background: Item{}
}
}*/
}
}
......
......@@ -19,13 +19,13 @@
********************************************************************************************/
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick 2.12
import QtQuick.Controls 2.12
import "qrc:/qml/style"
import "qrc:/javascript/print.js" as Print
import "qrc:/qml/various"
Item {
MouseArea {
id: channelRow
property string type: ""
property string username: ""
......@@ -35,22 +35,19 @@ Item {
property int unread: 0
property string lastMessage: ""
property bool blocked: false
signal pressAndHold()
signal pressed()
ItemDelegate {
onClicked: {
channelRow.pressed()
//roomSelector.channelChanged(channelRow.channelId, channelRow.channelName, channelRow.readonly)
pressAndHoldInterval:200
anchors.fill: parent
//flat: true
onPressed: {
rect.color = Colors.separatorGrey
}
onPressAndHold: {
channelRow.pressAndHold()
onReleased: {
rect.color = "transparent"
}
anchors.fill: parent
//flat: true
contentItem: Rectangle {
Rectangle {
id:rect
anchors.fill: parent
color: "transparent"
Row {
......@@ -137,7 +134,4 @@ Item {
anchors.verticalCenter: parent.verticalCenter
}
}
}
}
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtGraphicalEffects 1.0
import "qrc:/qml/style/"
Menu {
id:menu
width: {
var result = 0;
var padding = 0;
for (var i = 0; i < count; ++i) {
var item = itemAt(i);
result = Math.max(item.contentItem.implicitWidth, result);
padding = Math.max(item.padding, padding);
}
return result + padding * 2 +menu.padding;
}
padding: 2
background: Item{
/*Rectangle{
z:-1
......
......@@ -4,22 +4,21 @@ import QtQuick.Controls 2.2
import "qrc:/qml/style"
MenuItem {
id:menuItem
contentItem: StyledText{
text: parent.text
leftPadding: 5
anchors.verticalCenter: parent.verticalCenter
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
background: Rectangle{
anchors.fill: parent
anchors.topMargin: 3
anchors.leftMargin: 3
anchors.rightMargin: 3
background: Rectangle{
implicitHeight: 1
Rectangle{
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
width: parent.width
height: 1
color: Colors.grey
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment