ali_72
پنج شنبه 01 بهمن 1394, 14:05 عصر
سلام
دیالوگ پیش فرض دیالوگ قشنگی نیست
من از دیالوگ Material گوگل استفاده کردم
الان زمانیکه من از این یالوگ به تنهایی استفاده میکنم مشکلی نیست
ولی زمانیکه کنترل های دیگه ای وسط فرم هستند
دیالوگ به پشت کنترل ها میرود و بالای آن ها نمایش داده نمی شود
خواستم کد دیالوگ Material را تغییر بدم تا این مشکل برطرف شه
ولی موفق نشدم
لطفا راهنمایی کنید
ممنون
کد من:
import QtQuick.Window 2.2import QtQuick.Controls.Styles 1.4
import QtQuick.Extras 1.4
import QtQuick.Layouts 1.2
import QtQuick.Controls 1.4
import QtQuick.Dialogs 1.1
import QtGraphicalEffects 1.0
import QtQuick.Controls.Private 1.0
import Material.Extras 0.1
import QtQuick 2.4
import Material 0.1
import Material.ListItems 0.1 as ListItem
import QtQuick.Controls 1.3 as QuickControls
import QtMultimedia 5.4
ApplicationWindow {
visible: true
id:mainWindow
visibility: "Maximized"
width: Screen.width
height: Screen.height
color: "White"
Dialog {
id: crollingDialog
title: "select item"
positiveButtonText: "ok"
negativeButtonText: "cancel"
QuickControls.ExclusiveGroup {
id: optionGroup
}
RadioButton {
text: "item 1"
checked: true
exclusiveGroup: optionGroup
}
RadioButton {
text: "item 2"
exclusiveGroup: optionGroup
}
RadioButton {
text: "item 3"
exclusiveGroup: optionGroup
}
}
ColumnLayout {
anchors.fill: parent
spacing: 0
RowLayout {
spacing: 0
Layout.fillHeight: true
Layout.fillWidth: true
Rectangle {
Layout.fillHeight: true
Layout.fillWidth: true
color: "transparent"
ColumnLayout {
anchors.fill: parent
Layout.fillWidth: true
Layout.fillHeight: true
spacing: 0
RowLayout {
spacing: 0
Layout.preferredHeight: 0.06*parent.height
Layout.fillHeight: false
Layout.fillWidth: true
Rectangle {
id:transparentBorderRect
Layout.fillHeight: true
Layout.fillWidth: true
ColumnLayout {
anchors.fill: parent
spacing: 0
RowLayout {
spacing: 0
Layout.fillWidth: true
Layout.fillHeight: true
Rectangle {
Layout.fillHeight: true
Layout.fillWidth: true
color: "transparent"
ColumnLayout {
anchors.fill: parent
spacing: 0
RowLayout {
spacing: 0
Layout.fillWidth: true
Layout.fillHeight: true
ToolBar {
anchors.fill: parent
Layout.fillHeight: true
Layout.alignment: Qt.LeftToRight
style: ToolBarStyle {
background: Rectangle {
color: "red"
}
}
RowLayout {
anchors.fill: parent
MyToolButton{
id:tbUsb
MouseArea
{
id: maUsb
anchors.fill: parent
anchors.margins: -10
hoverEnabled:true
onClicked: crollingDialog.show()
cursorShape: Qt.OpenHandCursor
}
iconSource:maUsb.containsMouse ? "images/video2.png":"images/video.png"
}
}
}
}
}
}
}
}
}
}
RowLayout {
spacing: 0
Layout.preferredHeight: 0.94*parent.height
Layout.fillHeight: false
Layout.fillWidth: true
Rectangle {
id : cameraUI
anchors.fill: parent
Layout.fillWidth: true
Layout.fillHeight: true
color: "transparent"
state: "VideoCapture"
states: [
State {
name: "PhotoCapture"
StateChangeScript {
script: {
camera.captureMode = Camera.CaptureStillImage
camera.start()
}
}
},
State {
name: "PhotoPreview"
},
State {
name: "VideoCapture"
StateChangeScript {
script: {
camera.captureMode = Camera.CaptureVideo
camera.start()
}
}
},
State {
name: "VideoPreview"
StateChangeScript {
script: {
camera.stop()
}
}
}
]
Camera {
id: camera
captureMode: Camera.CaptureStillImage
videoRecorder {
id:vr
}
imageCapture {
onImageCaptured: {
photoPreview.source = preview
stillControls.previewAvailable = true
cameraUI.state = "PhotoPreview"
}
}
}
PhotoPreview {
id : photoPreview
anchors.fill : parent
onClosed: cameraUI.state = "PhotoCapture"
visible: cameraUI.state == "PhotoPreview"
focus: visible
}
VideoPreview {
id : videoPreview
anchors.fill : parent
onClosed: cameraUI.state = "VideoCapture"
visible: cameraUI.state == "VideoPreview"
focus: visible
//don't load recorded video if preview is invisible
source: visible ? camera.videoRecorder.actualLocation : ""
}
VideoOutput {
id: viewfinder
visible: cameraUI.state == "PhotoCapture" || cameraUI.state == "VideoCapture"
x: 0
y: 0
anchors.fill : parent
width: parent.width
height: parent.height
source: camera
autoOrientation: true
}
PhotoCaptureControls {
id: stillControls
anchors.fill: parent
camera: camera
visible: cameraUI.state == "PhotoCapture"
onPreviewSelected: cameraUI.state = "PhotoPreview"
onVideoModeSelected: cameraUI.state = "VideoCapture"
}
VideoCaptureControls {
id: videoControls
anchors.fill: parent
camera: camera
visible: cameraUI.state == "VideoCapture"
onPreviewSelected: cameraUI.state = "VideoPreview"
onPhotoModeSelected: cameraUI.state = "PhotoCapture"
}
}
}
}
}
}
}
}
دیالوگ پیش فرض دیالوگ قشنگی نیست
من از دیالوگ Material گوگل استفاده کردم
الان زمانیکه من از این یالوگ به تنهایی استفاده میکنم مشکلی نیست
ولی زمانیکه کنترل های دیگه ای وسط فرم هستند
دیالوگ به پشت کنترل ها میرود و بالای آن ها نمایش داده نمی شود
خواستم کد دیالوگ Material را تغییر بدم تا این مشکل برطرف شه
ولی موفق نشدم
لطفا راهنمایی کنید
ممنون
کد من:
import QtQuick.Window 2.2import QtQuick.Controls.Styles 1.4
import QtQuick.Extras 1.4
import QtQuick.Layouts 1.2
import QtQuick.Controls 1.4
import QtQuick.Dialogs 1.1
import QtGraphicalEffects 1.0
import QtQuick.Controls.Private 1.0
import Material.Extras 0.1
import QtQuick 2.4
import Material 0.1
import Material.ListItems 0.1 as ListItem
import QtQuick.Controls 1.3 as QuickControls
import QtMultimedia 5.4
ApplicationWindow {
visible: true
id:mainWindow
visibility: "Maximized"
width: Screen.width
height: Screen.height
color: "White"
Dialog {
id: crollingDialog
title: "select item"
positiveButtonText: "ok"
negativeButtonText: "cancel"
QuickControls.ExclusiveGroup {
id: optionGroup
}
RadioButton {
text: "item 1"
checked: true
exclusiveGroup: optionGroup
}
RadioButton {
text: "item 2"
exclusiveGroup: optionGroup
}
RadioButton {
text: "item 3"
exclusiveGroup: optionGroup
}
}
ColumnLayout {
anchors.fill: parent
spacing: 0
RowLayout {
spacing: 0
Layout.fillHeight: true
Layout.fillWidth: true
Rectangle {
Layout.fillHeight: true
Layout.fillWidth: true
color: "transparent"
ColumnLayout {
anchors.fill: parent
Layout.fillWidth: true
Layout.fillHeight: true
spacing: 0
RowLayout {
spacing: 0
Layout.preferredHeight: 0.06*parent.height
Layout.fillHeight: false
Layout.fillWidth: true
Rectangle {
id:transparentBorderRect
Layout.fillHeight: true
Layout.fillWidth: true
ColumnLayout {
anchors.fill: parent
spacing: 0
RowLayout {
spacing: 0
Layout.fillWidth: true
Layout.fillHeight: true
Rectangle {
Layout.fillHeight: true
Layout.fillWidth: true
color: "transparent"
ColumnLayout {
anchors.fill: parent
spacing: 0
RowLayout {
spacing: 0
Layout.fillWidth: true
Layout.fillHeight: true
ToolBar {
anchors.fill: parent
Layout.fillHeight: true
Layout.alignment: Qt.LeftToRight
style: ToolBarStyle {
background: Rectangle {
color: "red"
}
}
RowLayout {
anchors.fill: parent
MyToolButton{
id:tbUsb
MouseArea
{
id: maUsb
anchors.fill: parent
anchors.margins: -10
hoverEnabled:true
onClicked: crollingDialog.show()
cursorShape: Qt.OpenHandCursor
}
iconSource:maUsb.containsMouse ? "images/video2.png":"images/video.png"
}
}
}
}
}
}
}
}
}
}
RowLayout {
spacing: 0
Layout.preferredHeight: 0.94*parent.height
Layout.fillHeight: false
Layout.fillWidth: true
Rectangle {
id : cameraUI
anchors.fill: parent
Layout.fillWidth: true
Layout.fillHeight: true
color: "transparent"
state: "VideoCapture"
states: [
State {
name: "PhotoCapture"
StateChangeScript {
script: {
camera.captureMode = Camera.CaptureStillImage
camera.start()
}
}
},
State {
name: "PhotoPreview"
},
State {
name: "VideoCapture"
StateChangeScript {
script: {
camera.captureMode = Camera.CaptureVideo
camera.start()
}
}
},
State {
name: "VideoPreview"
StateChangeScript {
script: {
camera.stop()
}
}
}
]
Camera {
id: camera
captureMode: Camera.CaptureStillImage
videoRecorder {
id:vr
}
imageCapture {
onImageCaptured: {
photoPreview.source = preview
stillControls.previewAvailable = true
cameraUI.state = "PhotoPreview"
}
}
}
PhotoPreview {
id : photoPreview
anchors.fill : parent
onClosed: cameraUI.state = "PhotoCapture"
visible: cameraUI.state == "PhotoPreview"
focus: visible
}
VideoPreview {
id : videoPreview
anchors.fill : parent
onClosed: cameraUI.state = "VideoCapture"
visible: cameraUI.state == "VideoPreview"
focus: visible
//don't load recorded video if preview is invisible
source: visible ? camera.videoRecorder.actualLocation : ""
}
VideoOutput {
id: viewfinder
visible: cameraUI.state == "PhotoCapture" || cameraUI.state == "VideoCapture"
x: 0
y: 0
anchors.fill : parent
width: parent.width
height: parent.height
source: camera
autoOrientation: true
}
PhotoCaptureControls {
id: stillControls
anchors.fill: parent
camera: camera
visible: cameraUI.state == "PhotoCapture"
onPreviewSelected: cameraUI.state = "PhotoPreview"
onVideoModeSelected: cameraUI.state = "VideoCapture"
}
VideoCaptureControls {
id: videoControls
anchors.fill: parent
camera: camera
visible: cameraUI.state == "VideoCapture"
onPreviewSelected: cameraUI.state = "VideoPreview"
onPhotoModeSelected: cameraUI.state = "PhotoCapture"
}
}
}
}
}
}
}
}