Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package;
- import qt.core.Application;
- import qt.core.Orientation;
- import qt.layout.HBoxLayout;
- import qt.layout.VBoxLayout;
- import qt.styles.StyleFactory;
- import qt.widgets.CheckBox;
- import qt.widgets.Label;
- import qt.widgets.LineEdit;
- import qt.widgets.MainWindow;
- import qt.widgets.ProgressBar;
- import qt.widgets.PushButton;
- import qt.widgets.RadioButton;
- import qt.widgets.ScrollArea;
- import qt.widgets.Slider;
- import qt.widgets.Widget;
- @:buildXml('
- <files id="haxe">
- <compilerflag value="-IC:\\Qt\\5.7\\msvc2015_64\\include"/>
- </files>
- <target id="haxe">
- <lib name="C:/Qt/5.7/msvc2015_64/lib/Qt5Core.lib" />
- <lib name="C:/Qt/5.7/msvc2015_64/lib/Qt5Widgets.lib" />
- <lib name="C:/Qt/5.7/msvc2015_64/lib/Qt5Gui.lib" />
- </target>
- ')
- class Main {
- static function main() {
- //Application.style = StyleFactory.create("Fusion");
- //Application.style = StyleFactory.create("plastique");
- var app = new Application();
- //trace(StyleFactory.create("Plastique"));
- var main = new MainWindow();
- main.resize(640, 480);
- main.show();
- var mainLayout = new HBoxLayout();
- mainLayout.spacing = 0;
- mainLayout.setContentsMargins(0, 0, 0, 0);
- var central = new Widget();
- //central.layout = mainLayout;
- var root = new Widget();
- root.parent = central;
- root.layout = mainLayout;
- var col1 = new Widget();
- var col1Layout = new VBoxLayout();
- col1Layout.spacing = 0;
- col1Layout.setContentsMargins(0, 0, 0, 0);
- col1.layout = col1Layout;
- mainLayout.addWidget(col1);
- var vbox = new Widget();
- //vbox.parent = central;
- var vboxLayout = new VBoxLayout();
- //vboxLayout.setContentsMargins(0, 0, 0, 0);
- var button = new PushButton(); button.text = "Button 1"; vboxLayout.addWidget(button);
- var button = new PushButton(); button.text = "Button 2"; vboxLayout.addWidget(button);
- var button = new PushButton(); button.text = "Button 3"; vboxLayout.addWidget(button);
- vbox.layout = vboxLayout;
- col1Layout.addWidget(vbox);
- var hbox = new Widget();
- var hboxLayout = new HBoxLayout();
- var button = new PushButton(); button.text = "Button 1"; hboxLayout.addWidget(button);
- var button = new PushButton(); button.text = "Button 2"; hboxLayout.addWidget(button);
- var button = new PushButton(); button.text = "Button 3"; hboxLayout.addWidget(button);
- hbox.layout = hboxLayout;
- col1Layout.addWidget(hbox);
- var hbox = new Widget();
- var hboxLayout = new HBoxLayout();
- var button = new CheckBox(); button.text = "Check 1"; hboxLayout.addWidget(button);
- var button = new CheckBox(); button.text = "Check 2"; hboxLayout.addWidget(button);
- var button = new CheckBox(); button.text = "Check 3"; hboxLayout.addWidget(button);
- hbox.layout = hboxLayout;
- col1Layout.addWidget(hbox);
- var hbox = new Widget();
- var hboxLayout = new HBoxLayout();
- var button = new RadioButton(); button.text = "Option 1"; hboxLayout.addWidget(button);
- var button = new RadioButton(); button.text = "Option 2"; hboxLayout.addWidget(button);
- var button = new RadioButton(); button.text = "Option 3"; hboxLayout.addWidget(button);
- hbox.layout = hboxLayout;
- col1Layout.addWidget(hbox);
- var hbox = new Widget();
- var hboxLayout = new HBoxLayout();
- var label = new Label(); label.text = "Label"; hboxLayout.addWidget(label);
- var button = new PushButton(); button.text = "Click Me!"; hboxLayout.addWidget(button);
- button.connectClicked(function() { label.text = "Thanks!"; });
- hbox.layout = hboxLayout;
- col1Layout.addWidget(hbox);
- var hbox = new Widget();
- var hboxLayout = new HBoxLayout();
- var progress = new ProgressBar();
- progress.value = 50;
- hboxLayout.addWidget(progress);
- var slider = new Slider();
- slider.value = 50;
- slider.orientation = Orientation.Horizontal;
- hboxLayout.addWidget(slider);
- hbox.layout = hboxLayout;
- col1Layout.addWidget(hbox);
- var hbox = new Widget();
- var hboxLayout = new HBoxLayout();
- var lineEdit = new LineEdit();
- lineEdit.text = "Line edit";
- hboxLayout.addWidget(lineEdit);
- hbox.layout = hboxLayout;
- col1Layout.addWidget(hbox);
- var col2 = new Widget();
- var col2Layout = new VBoxLayout();
- col2Layout.spacing = 0;
- col2Layout.setContentsMargins(0, 0, 0, 0);
- col2.layout = col2Layout;
- mainLayout.addWidget(col2);
- var vbox = new Widget();
- var vboxLayout = new VBoxLayout();
- var scrollArea = new ScrollArea();
- vboxLayout.addWidget(scrollArea);
- vbox.layout = vboxLayout;
- var scrollContents = new Widget();
- var scrollContentsLayout = new VBoxLayout();
- for (a in 0...20) {
- var b = new PushButton();
- b.text = "Button " + a;
- scrollContentsLayout.addWidget(b);
- }
- scrollContents.layout = scrollContentsLayout;
- scrollArea.widget = scrollContents;
- col2Layout.addWidget(vbox);
- /*
- var vbox = new Widget();
- //vbox.parent = central;
- var vboxLayout = new VBoxLayout();
- //vboxLayout.setContentsMargins(0, 0, 0, 0);
- var button = new PushButton(); button.text = "Button 1"; vboxLayout.addWidget(button);
- var button = new PushButton(); button.text = "Button 2"; vboxLayout.addWidget(button);
- var button = new PushButton(); button.text = "Button 3"; vboxLayout.addWidget(button);
- vbox.layout = vboxLayout;
- col2Layout.addWidget(vbox);
- */
- //central.layout = mainLayout;
- main.centralWindow = central;
- /*
- var button = new PushButton();
- button.parent = central;
- button.text = "&Test1";
- button.x = 10;
- button.y = 10;
- button.connectClicked(clickHandler);
- var checkbox = new CheckBox();
- checkbox.parent = central;
- checkbox.text = "Test2";
- checkbox.x = 10;
- checkbox.y = 40;
- checkbox.connectClicked(function(checked:Bool = false) {
- trace("Checkbox clicked: " + checked);
- });
- */
- central.show();
- app.exec();
- }
- static function clickHandler() {
- trace("Button clicked!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement