Skip to content

Commit

Permalink
Added Absolute position demo
Browse files Browse the repository at this point in the history
Changed LICENSE from LGPL to Apache
  • Loading branch information
dsoronda committed Jul 25, 2016
1 parent 3e57e5b commit 6ffe121
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 517 deletions.
511 changes: 10 additions & 501 deletions LICENSE

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions source/QtSharpDemos/GuiExample/AbsolutePositionDemo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using QtCore;
using QtGui;
using QtWidgets;

namespace QtSharpDemos.GuiExample
{
class AbsolutePositionDemo : QtWidgets.QWidget
{
public AbsolutePositionDemo()
{
WindowTitle = "Absolute position demo";

InitUI();

Resize(300, 280);
Move(300, 300);
Show();
}

void InitUI()
{
StyleSheet = "QWidget { background-color: #414141 }";

var qt_icon = new QPixmap(@"media\gfx\Apps-Qt-icon.png");
//var rotunda = new QPixmap("rotunda.jpg");
//var mincol = new QPixmap("mincol.jpg");

var barLabel = new QLabel(this);
barLabel.Pixmap = qt_icon;
barLabel.Move(20, 20);

var rotLabel = new QLabel(this);
rotLabel.Pixmap = qt_icon;
rotLabel.Move(40, 160);

var minLabel = new QLabel(this);
minLabel.Pixmap = qt_icon;
minLabel.Move(170, 50);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

namespace QtSharpDemos.GuiExample
{
class QtQuitButtonDemo1 : QtWidgets.QWidget
class QuitButtonDemo : QtWidgets.QWidget
{
public QtQuitButtonDemo1()
public QuitButtonDemo()
{
WindowTitle = "Quit button";

Expand All @@ -25,14 +25,13 @@ public void InitUI()
var quitButton = new QtWidgets.QPushButton("Quit", this);

var method = new QtCore.QMetaMethod();

// Connect button signal to appropriate slot
// This is from : [Qt documentation] (https://wiki.qt.io/How_to_Use_QPushButton)
//connect(m_button, SIGNAL(released()), this, SLOT(handleButton()));
// Connect(quitButton, SIGNAL(clicked()), this, SLOT(quit()));
Connect(quitButton, "clicked()", this.ParentWidget, "quit()");
// resize button
quitButton.Clicked += QuitButton_Clicked;
quitButton.SetGeometry(50, 50, 80, 30);
}

private void QuitButton_Clicked(bool obj)
{
this.Close();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ namespace QtSharpDemos.GuiExample
/// <summary>
/// Create simple Qt widget control.
/// </summary>
class QtWidgetDemo1 : QtWidgets.QWidget
class WidgetDemo : QtWidgets.QWidget
{
const int WIDTH = 300;
const int HEIGHT = 200;

public QtWidgetDemo1()
public WidgetDemo()
{
WindowTitle = "QtWidget Demo";
ToolTip = "This is QT Qwidget";
Expand Down
5 changes: 3 additions & 2 deletions source/QtSharpDemos/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ static void Main(string[] args)
{
var qtApp = new QApplication(ref count, null);
}
//var w = new QtWidgetDemo1();
var wuitButtonDemo = new QtQuitButtonDemo1();
//var w = new WidgetDemo();
//var quitButtonDemo = new QuitButtonDemo();
var x = new AbsolutePositionDemo();
QApplication.Exec();
}
catch (Exception)
Expand Down
11 changes: 8 additions & 3 deletions source/QtSharpDemos/QtSharpDemos.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,20 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="GuiExample\QtWidgetDemo1.cs" />
<Compile Include="GuiExample\QtQuitButtonDemo1.cs" />
<Compile Include="GuiExample\AbsolutePositionDemo.cs" />
<Compile Include="GuiExample\WidgetDemo.cs" />
<Compile Include="GuiExample\QuitButtonDemo.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Content Include="media\gfx\Apps-Qt-icon.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
Binary file added source/QtSharpDemos/media/gfx/Apps-Qt-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6ffe121

Please sign in to comment.