# About Example
# Supply specific QDockWidget's symbolic or real name (in this sample application QDockWidget is ColorSwatch)
# change_* functions take three parameters: QDockWidget as o, resize value as xdiff, snooze in seconds (optional) as snoozeFactor
import names
def main():
startApplication("mainwindow")
dockToResize = waitForObject({"name": "Dock Widget", "type": "ColorSwatch", "window": names.Main_Window_Demo_MainWindow})
change_height_on_top(dockToResize, -20)
change_height_on_top(dockToResize, 20)
change_height_on_bottom(dockToResize, -20)
change_height_on_bottom(dockToResize, 20)
change_width_on_left(dockToResize, -20)
change_width_on_left(dockToResize, 20)
change_width_on_right(dockToResize, 20)
change_width_on_right(dockToResize, -20)
def change_height_on_top(o, xdiff, snoozeFactor = 0):
snooze(snoozeFactor)
mousePress(o, 50, -2, MouseButton.LeftButton)
start = 0
end = xdiff
step = 1
if xdiff < 0:
step = -1
for i in range(start, end, step):
mouseMove(o, 50, -2 + i)
mouseRelease()
snooze(snoozeFactor)
def change_height_on_bottom(o, xdiff, snoozeFactor = 0):
snooze(snoozeFactor)
mousePress(o, 50, o.height + 2, MouseButton.LeftButton)
start = 0
end = xdiff
step = 1
if xdiff < 0:
step = -1
for i in range(start, end, step):
mouseMove(o, 50, o.height + 2 + i)
mouseRelease()
snooze(snoozeFactor)
def change_width_on_left(o, xdiff, snoozeFactor = 0):
snooze(snoozeFactor)
mousePress(o, -3, 50, MouseButton.LeftButton)
start = 0
end = xdiff
step = 1
if xdiff < 0:
step = -1
for i in range(start, end, step):
mouseMove(o, -3 + i, 50)
mouseRelease()
snooze(snoozeFactor)
def change_width_on_right(o, xdiff, snoozeFactor = 0):
snooze(snoozeFactor)
mousePress(o, o.width + 3, 50, MouseButton.LeftButton)
start = 0
end = xdiff
step = 1
if xdiff < 0:
step = -1
for i in range(start, end, step):
mouseMove(o, o.width + 3 + i, 50)
mouseRelease()
snooze(snoozeFactor)