GithubHelp home page GithubHelp logo

tabbedui's Introduction

*************************************************************************************
My First GUI Application
*************************************************************************************
-------------------------------------------------------------------------------------
Goal
-------------------------------------------------------------------------------------
   I wanted to create a window with tabs. The tabs were to be hover sensitive.
Whenever the mouse hovered on the inactive tabs, their previews were to come up as a
thumbnail.
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
What's been successfully accomplished
-------------------------------------------------------------------------------------
1: I do get a window with tabs :P
2: I get previews. ( I've managed to make it less of a mess, yet gotta work on a few
   finer points )
3: I was really doubtful whether I'd be able to make sure the tabs come up only when
   mouse hovers on *inactive* tabs. Thankfully, that didn't prove to be too difficult
4: Was worried that thumbnails would come up at odd positions. Luckily, they don't
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
What I tried to accomplish and failed
-------------------------------------------------------------------------------------
1: I tried to create a frame of suitable size below the tab on which mouse was
   positioned. Didn't work out (still trying to find out why). No errors or crashes,
   but the frames just didn't come up.
2: Tried to link the mouse entry into the QRect region containg the tab (in the
   tab-bar) to it's slot. Didn't work out as connect links signals generated by one
   *widget* to slot of another/same *widget*. (QRect objects are not inherited from
   QWidgets and casting them is not a solution.)
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
What's being tried
-------------------------------------------------------------------------------------
1: Trying to read rekonq's handling of similar task and trying to apply it to this
   task (as much as possible)
2: Image in tab2 is not being loaded. Have to work on that.
3: The previews are being destroyed after a long time (destructor waits for some time
   to verify that the memory location is actually freed. This has to be speedened up)
4: The behaviour of the hovering and popping up of previews is wierd (sometimes it
   pops up and sometimes it doesn't) -maybe because of delay in destructor invocation
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
What needs to be done in the future
-------------------------------------------------------------------------------------
   At present, my strategy has been : "Get the work done - By hook or crook ". Got to
switch to the sweeter philosophy - "Get the work done - Do it right" :)

1: Presently, I've manually created three tabs. It should be generalized with an 'add
   Tab' button next to the rightmost tab.
2: Handling of slots/variables/signals is highly inefficient. Improvement needed.
3: Though close buttons have been enabled, code to handle the 'destroyed' signal
   hasn't been written
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
Questions to be answered
-------------------------------------------------------------------------------------
1: How do I control the position where a widget is created?
2: Presently, destructor is being called on the previews when mouse is moved to the
   right of the rightmost tab, but not when it moves into the child widget (ie, the
   widget within the tab). How do I repair this?
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
Potential solutions to questions previously in 'to be answered' section
-------------------------------------------------------------------------------------
1: How do I trigger the signal when mouse hovers over a tab?
Solution: Override mouseMoveEvent() and use tabRect()

2: How do I get info from individual tab for preview?
Solution: Not possible unless you have *some* content in the tab. So create content
          and collect it's info :)

3: Why were the image previews so ugly and how do I retify them?
Solution: Since I hadn't enabled hover to the widget and instead used the QRect's
          contains() method to emit the signal, a new preview popup was created every
          time the mouse moved within the tabs. So multiple instances lead to the
          ugly nature of popups. So I created a local preview object and checked for
          existence of previews before creating new ones
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
What's great about this task
-------------------------------------------------------------------------------------
1: The kick you get when the window comes up
2: Isn't that enough? ;-D :P
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
What's frustrating about this task
-------------------------------------------------------------------------------------
1: No way to test before writing a large portion of code
2: Inexperience GUI programming. Seeing many errors for the first time in life. :P
3: Simplicity of solution to errors versus the time spent to think of the solution
   (That's why you're reading such a long README :P )
-------------------------------------------------------------------------------------

tabbedui's People

Stargazers

Shrikrishna Holla avatar

Watchers

James Cloos avatar Shrikrishna Holla avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.