Skip to content

Instantly share code, notes, and snippets.

@rschroll
Created July 3, 2014 16:16
Show Gist options
  • Save rschroll/50b75537dd4f814a827b to your computer and use it in GitHub Desktop.
Save rschroll/50b75537dd4f814a827b to your computer and use it in GitHub Desktop.
Demonstrating problems with Dialog sizing in the Ubuntu toolkit
/* Copyright 2013 Robert Schroll
*
* This file is part of Beru and is distributed under the terms of
* the GPL. See the file COPYING for full details.
*/
import QtQuick 2.0
import Ubuntu.Components 0.1
import Ubuntu.Components.ListItems 0.1
import Ubuntu.Components.Popups 0.1
import QtWebKit 3.0
import QtWebKit.experimental 1.0
MainView {
// objectName for functional testing purposes (autopilot-qt5)
objectName: "mainView"
id: mainView
width: units.gu(65)
height: units.gu(100)
Page {
id: bookPage
tools: ToolbarItems {
id: bookPageToolbar
ToolbarButton {
id: settingsButton
action: Action {
text: i18n.tr("Settings")
onTriggered: PopupUtils.open(stylesComponent, settingsButton)
}
}
}
Component {
id: stylesComponent
Dialog {
id: stylesDialog
property real labelwidth: units.gu(11)
OptionSelector {
id: colorSelector
model: ["One", "Two", "Three"]
}
Row {
Label {
text: i18n.tr("Font Scaling")
verticalAlignment: Text.AlignVCenter
width: labelwidth
height: fontScaleSlider.height
}
Slider {
id: fontScaleSlider
width: parent.width - labelwidth
minimumValue: 0
maximumValue: 12
}
}
Button {
text: i18n.tr("Close")
onClicked: PopupUtils.close(stylesDialog)
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment