qt

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2023 License: BSD-2-Clause-Views Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FILL_NONE int = iota
	FILL_SOLID
	FILL_OP_0
	FILL_OP_1
	FILL_OP_2
	FILL_OP_3
	FILL_OP_4
	FILL_OP_5
	FILL_OP_6
	FILL_HORIZ
	FILL_VERT
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Font

type Font struct {
	// contains filtered or unexported fields
}

type Font_mgr

type Font_mgr struct {
	// contains filtered or unexported fields
}

func Mk_font_mgr

func Mk_font_mgr() *Font_mgr

Allocate a font manager.

func (*Font_mgr) Add

func (fm *Font_mgr) Add(ref_name string, name string, size int, weight int, ital bool) *Font

Create a font and save it with a user supplied reference name.

func (*Font_mgr) Get

func (fm *Font_mgr) Get(ref_name string) *gui.QFont

Look up and return the font using the reference name. The font returned is suitable for passing to QT functions.

type Gen_colour

type Gen_colour struct {
	// contains filtered or unexported fields
}

QT seems to have mutiple ways to refernece colour and none are compatable with each other. Damn C++ programmers. So, we manage a generic colour struct which can be used to track a colour in various shapes and sizes to be passed to QT in what ever fashion it fancies.

func Mk_gen_colour

func Mk_gen_colour(cvalue string, alpha int) *Gen_colour

Given a string (#rrggbb, 0xrrggbb or name)

func (*Gen_colour) Get_global_colour

func (gc *Gen_colour) Get_global_colour() core.Qt__GlobalColor

Return the equiv qt core global colour object.

func (*Gen_colour) Get_gui_colour

func (gc *Gen_colour) Get_gui_colour() *gui.QColor

Return the equiv qt colour object.

type Qt_api

type Qt_api struct {
	// contains filtered or unexported fields
}

The qt context struct passed round bwtween user and functions here.

func Mk_qt_gc

func Mk_qt_gc() (gc *Qt_api)

Create a graphics context into the QT world.

func (*Qt_api) Clear

func (qt *Qt_api) Clear()

These funcitons must exist, if only as dummies, to implement as sketch interface. The following are unimplemented or will always be dummies as they really aren't supported.

func (*Qt_api) Clear_subpage

func (qt *Qt_api) Clear_subpage(pname string)

func (*Qt_api) Close

func (qt *Qt_api) Close()

func (*Qt_api) Delete_subpage

func (qt *Qt_api) Delete_subpage(pname string)

func (*Qt_api) Draw_arc

func (qt *Qt_api) Draw_arc(x float64, y float64, radius float64, a1 float64, a2 float64)

Draw_arc draws an arc centered at x,y with the given readius. Angles a1 and a2 are the start and ending points of the arc measured in degrees anticlokwise from the x-axis.

func (*Qt_api) Draw_circle

func (qt *Qt_api) Draw_circle(xo float64, yo float64, radius float64, outline bool)

func (*Qt_api) Draw_line

func (qt *Qt_api) Draw_line(x1 float64, y1 float64, x2 float64, y2 float64)

Draw a line in the active window/drawport.

func (*Qt_api) Draw_pie

func (qt *Qt_api) Draw_pie(xo float64, yo float64, radius float64, alpha1 float64, alpha2 float64, outline bool)

func (*Qt_api) Draw_poly

func (qt *Qt_api) Draw_poly(point []*sktools.Point, outline bool)

func (*Qt_api) Draw_rect

func (qt *Qt_api) Draw_rect(xo float64, yo float64, height float64, width float64, outline bool)

func (*Qt_api) Draw_text

func (qt *Qt_api) Draw_text(xo float64, yo float64, text string)

func (*Qt_api) Engague

func (qt *Qt_api) Engague()

Pass control to the QT driver; all remaining interaction once the user calls this Function is through call backs.

func (*Qt_api) Mk_page

func (qt *Qt_api) Mk_page(name string, h int, w int, title string) error

Add a new 'page' (window) with the given height, width and title. Returns error if unable. Name is the reference string that is used to select or address the window.

func (*Qt_api) Mk_subpage

func (qt *Qt_api) Mk_subpage(name string, ox float64, oy float64, h float64, w float64)

Add a drawport to the active window.

func (*Qt_api) Paint_all

func (qt *Qt_api) Paint_all()

Paint all windows.

func (*Qt_api) Pop_state

func (qt *Qt_api) Pop_state()

func (*Qt_api) Push_state

func (qt *Qt_api) Push_state()

func (*Qt_api) Rotate

func (qt *Qt_api) Rotate(degrees float64)

func (*Qt_api) Select_page

func (qt *Qt_api) Select_page(name string)

Set the active window for operations.

func (*Qt_api) Select_subpage

func (qt *Qt_api) Select_subpage(pname string)

func (*Qt_api) Selelect_sub_page

func (qt *Qt_api) Selelect_sub_page(name string)

Select the named drawport in the active window. All drawing commands following the selection, until another is selected, are applied to this drawport.

func (*Qt_api) Set_colour

func (qt *Qt_api) Set_colour(name string)

Set the foreground colour for the current window's ative drawport

func (*Qt_api) Set_dimensions

func (qt *Qt_api) Set_dimensions(height float64, width float64)

func (*Qt_api) Set_fill_attrs

func (qt *Qt_api) Set_fill_attrs(cname string, fill_style int)

Set the colour and fill style to use when filling objects.

func (*Qt_api) Set_font

func (qt *Qt_api) Set_font(font_name string, size int, weight int, ital bool)

Define a font and add it to the active drawport. Future: add to all drawports

func (*Qt_api) Set_line_style

func (qt *Qt_api) Set_line_style(pattern []int)

func (*Qt_api) Set_line_width

func (qt *Qt_api) Set_line_width(width int)

func (*Qt_api) Set_page_colour

func (qt *Qt_api) Set_page_colour(cname string)

Set the background colour for the active drawport in the active window. Cname is any valid colour name or hex rgb string. Mode is any of the FILL_ mode constants.

func (*Qt_api) Set_scale

func (qt *Qt_api) Set_scale(xscale float64, yscale float64)

func (*Qt_api) Show

func (qt *Qt_api) Show()

func (*Qt_api) Translate_delta

func (qt *Qt_api) Translate_delta(dx float64, dy float64)

type Qt_drawport

type Qt_drawport struct {
	// contains filtered or unexported fields
}

A portion of the window that can be drawn into independently forom other drawports.

func Mk_drawport

func Mk_drawport(ox int, oy int, h int, w int) *Qt_drawport

func (*Qt_drawport) Add_font

func (dp *Qt_drawport) Add_font(ref_name string, name string, size int, weight int, ital bool)

Define a font and add it to the drawport

func (*Qt_drawport) Draw_arc

func (dp *Qt_drawport) Draw_arc(xo float64, yo float64, radius float64, alpha1 float64, alpha2 float64)

Draw_arc paintes an arc centered at xo,yo with the given radius. The angles alpha1 and alpha2 define the starting (a1) and ending (a2) points in degrees anticlockwise from the X-axis.

func (*Qt_drawport) Draw_line

func (dp *Qt_drawport) Draw_line(x1 float64, y1 float64, x2 float64, y2 float64, colour *Gen_colour)

Draw a line from x1,y1 to x2,y2 using the indicated colour..

func (*Qt_drawport) Draw_rect

func (dp *Qt_drawport) Draw_rect(x1 float64, y1 float64, h float64, w float64, colour *Gen_colour)

Draw a rectangle from with a lower left corner of x1, y1 and a height and width. Future: allow fill parms to be referenced with a name as a final parm.

func (*Qt_drawport) Draw_text

func (dp *Qt_drawport) Draw_text(x float64, y float64, value string, font string, cname string)

Add the text string with value to the canvas at the current position. Font is the reference name that was added to the canvas. The cname var may be a recognised name, or #rrggbb/0xrrggbb value string.

func (*Qt_drawport) Get_object

func (dp *Qt_drawport) Get_object() *widgets.QWidget

Returns the "outermost" QT object that is represnted by the drawport.

func (*Qt_drawport) Paint

func (dp *Qt_drawport) Paint()

Actually cause it to paint.

func (*Qt_drawport) Render

func (dp *Qt_drawport) Render()

Transfer the scene to the canvas.

func (*Qt_drawport) Set_bg

func (dp *Qt_drawport) Set_bg(colour *Gen_colour, style int)

Set the background colour for the drawport. Mode is one of the FILL_* constants.

func (*Qt_drawport) Set_colour

func (dp *Qt_drawport) Set_colour(cname string)

Set the current drawport colour. The colour value (cv) may be a name (e.g. bluegreen) that is known to the colour package, or a hex rgb value in either of the forms #rrggbb or 0xrrggbb.

func (*Qt_drawport) Set_fill

func (dp *Qt_drawport) Set_fill(colour *Gen_colour, style int)

Set the fill (colour and style) for things that are filled (rectangle etc)

func (*Qt_drawport) Set_stylus

func (dp *Qt_drawport) Set_stylus()

Set the drawing stylus:

colour (r,g,b)

type Qt_window

type Qt_window struct {
	// contains filtered or unexported fields
}

Manages the main window.

func Mk_window

func Mk_window(title string, h int, w int) *Qt_window

func (*Qt_window) Add_drawport

func (win *Qt_window) Add_drawport(name string, ox int, oy int, h int, w int)

Add a drawport to the window with origin ox,oy.

func (*Qt_window) Add_font

func (win *Qt_window) Add_font(ref_name string, font_name string, size int, weight int, ital bool)

Add a font to the active drawport Future: add to all drawports

func (*Qt_window) Draw_line

func (win *Qt_window) Draw_line(x1 float64, y1 float64, x2 float64, y2 float64)

func (*Qt_window) Draw_text

func (win *Qt_window) Draw_text(x float64, y float64, text string, font string, colour string)

func (*Qt_window) Paint_all

func (win *Qt_window) Paint_all()

Paint all drawports in the window

func (*Qt_window) Sel_drawport

func (win *Qt_window) Sel_drawport(name string) (dp *Qt_drawport)

Sel_drawport selects the named drawport, making it active, and returns a pointer so that it can be used directly if desired.

func (*Qt_window) Set_colour

func (win *Qt_window) Set_colour(name string)

func (*Qt_window) Set_dp_colour

func (win *Qt_window) Set_dp_colour(cname string, mode int)

Set the bg colour for the active drawport. Name is any valid colour name or hex rgb string. Mode is one of the fill mode constants

func (*Qt_window) Set_fill

func (win *Qt_window) Set_fill(name string, style int)

Set fill colour and style.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL