Commit 32dfe067 authored by armin's avatar armin

fixed menus

parent 9963fb6f
Pipeline #776 passed with stage
in 3 minutes and 13 seconds
......@@ -49,12 +49,6 @@ StyledMenu{
}
delegate: StyledMenuItem{
Component.onCompleted: {
console.log("menu item delegate: "+width)
}
}
Component.onCompleted: {
console.log("width menu: "+width)
}
}
......@@ -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
}
}
}
}
......@@ -5,6 +5,7 @@ import QtGraphicalEffects 1.0
import "qrc:/qml/style/"
Menu {
id:menu
width: {
var result = 0;
var padding = 0;
......@@ -13,8 +14,9 @@ Menu {
result = Math.max(item.contentItem.implicitWidth, result);
padding = Math.max(item.padding, padding);
}
return result + padding * 2;
return result + padding * 2 +menu.padding;
}
padding: 2
background: Item{
/*Rectangle{
z:-1
......
......@@ -11,27 +11,14 @@ MenuItem {
leftPadding: 5
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
// elide: Text.ElideRight
Component.onCompleted: {
console.log("text width: "+width)
console.log("menu item width: "+menuItem.width)
}
elide: Text.ElideRight
}
background: Rectangle{
// implicitWidth: 200
implicitHeight: 1
// anchors.fill: parent
/* anchors.topMargin: 3
anchors.leftMargin: 3
anchors.rightMargin: 3
*/
Rectangle{
width: parent.width
/* anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right*/
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